Fix git-changelog to handle whitespace in command arguments (#1232)

This commit is contained in:
phanium 2026-03-06 15:06:10 +08:00 committed by GitHub
parent 967e339f91
commit 65dd36ae62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,6 +9,15 @@ GIT_MERGELOG_FORMAT="$(git config changelog.mergeformat)"
GIT_EDITOR="$(git var GIT_EDITOR)"
PROGNAME="git-changelog"
git_editor() {
if test -z "${GIT_EDITOR:+set}"
then
GIT_EDITOR="$(git var GIT_EDITOR)" || return $?
fi
eval "$GIT_EDITOR" '"$@"'
}
_usage() {
cat << EOF
usage: $PROGNAME options [file]
@ -574,7 +583,7 @@ main() {
rm -f "$tmpfile"
if [[ -n "$GIT_EDITOR" ]]; then
$GIT_EDITOR "$changelog" || _exit
git_editor "$changelog" || _exit
else
less "$changelog" || _exit
fi