Skip to content

Commit 6645838

Browse files
dschogitster
authored andcommitted
rebase -i: highlight problems with core.commentchar
The interactive rebase does not currently play well with core.commentchar. Let's add some tests to highlight those problems that will be fixed in the remainder of the series. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0b65a8d commit 6645838

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

t/t0030-stripspace.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,15 @@ test_expect_success '-c with changed comment char' '
432432
test_cmp expect actual
433433
'
434434

435+
test_expect_failure '-c with comment char defined in .git/config' '
436+
test_config core.commentchar = &&
437+
printf "= foo\n" >expect &&
438+
printf "foo" | (
439+
mkdir sub && cd sub && git stripspace -c
440+
) >actual &&
441+
test_cmp expect actual
442+
'
443+
435444
test_expect_success 'avoid SP-HT sequence in commented line' '
436445
printf "#\tone\n#\n# two\n" >expect &&
437446
printf "\tone\n\ntwo\n" | git stripspace -c >actual &&

t/t3404-rebase-interactive.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,17 @@ 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' '
987+
test_config core.commentchar auto &&
988+
write_script copy-edit-script.sh <<-\EOF &&
989+
cp "$1" edit-script
990+
EOF
991+
test_set_editor "$(pwd)/copy-edit-script.sh" &&
992+
test_when_finished "git rebase --abort || :" &&
993+
git rebase -i HEAD^ &&
994+
test -z "$(grep -ve "^#" -e "^\$" -e "^pick" edit-script)"
995+
'
996+
986997
test_expect_success 'rebase -i, with <onto> and <upstream> specified as :/quuxery' '
987998
test_when_finished "git branch -D torebase" &&
988999
git checkout -b torebase branch1 &&

0 commit comments

Comments
 (0)