rebase -i: handle core.commentChar=auto

When 84c9dc2 (commit: allow core.commentChar=auto for character auto selection, 2014-05-17) extended the core.commentChar functionality to allow for the value 'auto', it forgot that rebase -i was already taught to handle core.commentChar, and in turn forgot to let rebase -i handle that new value gracefully. Reported by Taufiq Hoven. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Nov 21, 2016 at 15:18 UTC 882cd23777f8984e433e0c0addae5e9d70de75e8
2 files changed +12 -3
git-rebase--interactive.sh
+11 -2
@@ -93,8 +93,17 @@ eval '
93 GIT_CHERRY_PICK_HELP="$resolvemsg"
94 export GIT_CHERRY_PICK_HELP
95
96 -comment_char=$(git config --get core.commentchar 2>/dev/null | cut -c1)
97 -: ${comment_char:=#}
96 +comment_char=$(git config --get core.commentchar 2>/dev/null)
97 +case "$comment_char" in
98 +'' | auto)
99 + comment_char="#"
100 + ;;
101 +?)
102 + ;;
103 +*)
104 + comment_char=$(echo "$comment_char" | cut -c1)
105 + ;;
106 +esac
107
108 warn () {
109 printf '%s\n' "$*" >&2
t/t3404-rebase-interactive.sh
+1 -1
@@ -983,7 +983,7 @@ test_expect_success 'rebase -i respects core.commentchar' '
983 test B = $(git cat-file commit HEAD^ | sed -ne \$p)
984 '
985
986 -test_expect_failure 'rebase -i respects core.commentchar=auto' '
986 +test_expect_success 'rebase -i respects core.commentchar=auto' '
987 test_config core.commentchar auto &&
988 write_script copy-edit-script.sh <<-\EOF &&
989 cp "$1" edit-script