Skip to content

Commit 882cd23

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 92068ae commit 882cd23

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

git-rebase--interactive.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,17 @@ eval '
9393
GIT_CHERRY_PICK_HELP="$resolvemsg"
9494
export GIT_CHERRY_PICK_HELP
9595

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
98107

99108
warn () {
100109
printf '%s\n' "$*" >&2

t/t3404-rebase-interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ test_expect_success 'rebase -i respects core.commentchar' '
983983
test B = $(git cat-file commit HEAD^ | sed -ne \$p)
984984
'
985985

986-
test_expect_failure 'rebase -i respects core.commentchar=auto' '
986+
test_expect_success 'rebase -i respects core.commentchar=auto' '
987987
test_config core.commentchar auto &&
988988
write_script copy-edit-script.sh <<-\EOF &&
989989
cp "$1" edit-script

0 commit comments

Comments
 (0)