Skip to content

Commit

Permalink
rebase -i: handle core.commentChar=auto
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dscho authored and gitster committed Nov 21, 2016
1 parent 92068ae commit 882cd23
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions git-rebase--interactive.sh
Expand Up @@ -93,8 +93,17 @@ eval '
GIT_CHERRY_PICK_HELP="$resolvemsg"
export GIT_CHERRY_PICK_HELP

comment_char=$(git config --get core.commentchar 2>/dev/null | cut -c1)
: ${comment_char:=#}
comment_char=$(git config --get core.commentchar 2>/dev/null)
case "$comment_char" in
'' | auto)
comment_char="#"
;;
?)
;;
*)
comment_char=$(echo "$comment_char" | cut -c1)
;;
esac

warn () {
printf '%s\n' "$*" >&2
Expand Down
2 changes: 1 addition & 1 deletion t/t3404-rebase-interactive.sh
Expand Up @@ -983,7 +983,7 @@ test_expect_success 'rebase -i respects core.commentchar' '
test B = $(git cat-file commit HEAD^ | sed -ne \$p)
'

test_expect_failure 'rebase -i respects core.commentchar=auto' '
test_expect_success 'rebase -i respects core.commentchar=auto' '
test_config core.commentchar auto &&
write_script copy-edit-script.sh <<-\EOF &&
cp "$1" edit-script
Expand Down

0 comments on commit 882cd23

Please sign in to comment.