]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t3432: test `--merge' with `rebase.abbreviateCommands = true', too
authorAlban Gruin <alban.gruin@gmail.com>
Mon, 30 Mar 2020 12:42:36 +0000 (14:42 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2020 19:47:25 +0000 (12:47 -0700)
When fast forwarding, `git --merge' should act the same whether
`rebase.abbreviateCommands' is set or not, but so far it was not the
case.  This duplicates the tests ensuring that `--merge' works when fast
forwarding to check if it also works with abbreviated commands.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3432-rebase-fast-forward.sh

index 6c9d4a13758194dfcf4b005e36f8358ed5a27f80..6f0452c0eac516796e27c5689b2e091c2b21b8ce 100755 (executable)
@@ -28,10 +28,12 @@ test_rebase_same_head () {
        shift &&
        cmp_f="$1" &&
        shift &&
-       test_rebase_same_head_ $status_n $what_n $cmp_n " --apply" "$*" &&
-       test_rebase_same_head_ $status_f $what_f $cmp_f " --apply --no-ff" "$*"
-       test_rebase_same_head_ $status_n $what_n $cmp_n " --merge" "$*" &&
-       test_rebase_same_head_ $status_f $what_f $cmp_f " --merge --no-ff" "$*"
+       test_rebase_same_head_ $status_n $what_n $cmp_n 0 " --apply" "$*" &&
+       test_rebase_same_head_ $status_f $what_f $cmp_f 0 " --apply --no-ff" "$*"
+       test_rebase_same_head_ $status_n $what_n $cmp_n 0 " --merge" "$*" &&
+       test_rebase_same_head_ $status_f $what_f $cmp_f 0 " --merge --no-ff" "$*"
+       test_rebase_same_head_ $status_n $what_n $cmp_n 1 " --merge" "$*" &&
+       test_rebase_same_head_ $status_f $what_f $cmp_f 1 " --merge --no-ff" "$*"
 }
 
 test_rebase_same_head_ () {
@@ -41,9 +43,21 @@ test_rebase_same_head_ () {
        shift &&
        cmp="$1" &&
        shift &&
+       abbreviate="$1" &&
+       shift &&
        flag="$1"
        shift &&
-       test_expect_$status "git rebase$flag $* with $changes is $what with $cmp HEAD" "
+       if test $abbreviate -eq 1
+       then
+               msg="git rebase$flag $* (rebase.abbreviateCommands = true) with $changes is $what with $cmp HEAD"
+       else
+               msg="git rebase$flag $* with $changes is $what with $cmp HEAD"
+       fi &&
+       test_expect_$status "$msg" "
+               if test $abbreviate -eq 1
+               then
+                       test_config rebase.abbreviateCommands true
+               fi &&
                oldhead=\$(git rev-parse HEAD) &&
                test_when_finished 'git reset --hard \$oldhead' &&
                cp .git/logs/HEAD expect &&