From 65dd36ae62cec964d295919bbfa358b19a797b5c Mon Sep 17 00:00:00 2001 From: phanium <91544758+phanen@users.noreply.github.com> Date: Fri, 6 Mar 2026 15:06:10 +0800 Subject: [PATCH] Fix `git-changelog` to handle whitespace in command arguments (#1232) --- bin/git-changelog | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/git-changelog b/bin/git-changelog index ad5c2bb..ab4367f 100755 --- a/bin/git-changelog +++ b/bin/git-changelog @@ -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