handle GIT_EDITOR which contains space

This commit is contained in:
spacewander 2016-01-20 11:39:39 +08:00
parent afce25cd65
commit a192fe688a

View file

@ -478,7 +478,10 @@ main() {
rm -f "$tmpfile"
else
cp -f "$tmpfile" "$changelog"
[[ -n "$GIT_EDITOR" ]] && $GIT_EDITOR "$changelog"
# Use `eval` to handle GIT_EDITOR which contains space and options,
# like ""C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst ".
# Thanks @JanSchulz to inspire me this solution
[[ -n "$GIT_EDITOR" ]] && eval $GIT_EDITOR "$changelog"
if [[ $? -ne 0 ]]; then
_exit
fi