]> granicus.if.org Git - git/commitdiff
rebase -i: highlight problems with core.commentchar
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 21 Nov 2016 14:18:05 +0000 (15:18 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Nov 2016 19:00:17 +0000 (11:00 -0800)
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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0030-stripspace.sh
t/t3404-rebase-interactive.sh

index 29e91d861cbd6473d80c7343a0e292b010d83173..c1f6411eb2d8d04585faf6d9289bd50d7c5f52cf 100755 (executable)
@@ -432,6 +432,15 @@ test_expect_success '-c with changed comment char' '
        test_cmp expect actual
 '
 
+test_expect_failure '-c with comment char defined in .git/config' '
+       test_config core.commentchar = &&
+       printf "= foo\n" >expect &&
+       printf "foo" | (
+               mkdir sub && cd sub && git stripspace -c
+       ) >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'avoid SP-HT sequence in commented line' '
        printf "#\tone\n#\n# two\n" >expect &&
        printf "\tone\n\ntwo\n" | git stripspace -c >actual &&
index d6d65a3a9435a456f8efad15b8c7c63db00a8e5f..d941f0a69ffa02e8f3744f2bc68b85b61b66d46d 100755 (executable)
@@ -983,6 +983,17 @@ 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_config core.commentchar auto &&
+       write_script copy-edit-script.sh <<-\EOF &&
+       cp "$1" edit-script
+       EOF
+       test_set_editor "$(pwd)/copy-edit-script.sh" &&
+       test_when_finished "git rebase --abort || :" &&
+       git rebase -i HEAD^ &&
+       test -z "$(grep -ve "^#" -e "^\$" -e "^pick" edit-script)"
+'
+
 test_expect_success 'rebase -i, with <onto> and <upstream> specified as :/quuxery' '
        test_when_finished "git branch -D torebase" &&
        git checkout -b torebase branch1 &&