@matheusbsbs / matheus-bagliano / commits / f8a1785807
Fork 0

t5520: make test_pull_autostash() accept expect_parent_num

Before, test_pull_autostash() was hardcoded to run `test_cmp_rev HEAD^ copy` to test that a rebase happened. However, in a future patch, we plan on testing merging as well. Make test_pull_autostash() accept a parent number as an argument so that, in the future, we can test if a merge happened in addition to a rebase. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Apr 7, 2020 at 10:28 UTC f8a178580719a93040a49cf25624f1d56d0147f1
1 file changed +8 -6
t/t5520-pull.sh
+8 -6
@@ -10,11 +10,13 @@ modify () {
10 }
11
12 test_pull_autostash () {
13 + expect_parent_num="$1" &&
14 + shift &&
15 git reset --hard before-rebase &&
16 echo dirty >new_file &&
17 git add new_file &&
18 git pull "$@" . copy &&
17 - test_cmp_rev HEAD^ copy &&
19 + test_cmp_rev HEAD^"$expect_parent_num" copy &&
20 echo dirty >expect &&
21 test_cmp expect new_file &&
22 echo "modified again" >expect &&
@@ -369,22 +371,22 @@ test_expect_success '--rebase fails with multiple branches' '
371
372 test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '
373 test_config rebase.autostash true &&
372 - test_pull_autostash --rebase
374 + test_pull_autostash 1 --rebase
375 '
376
377 test_expect_success 'pull --rebase --autostash & rebase.autostash=true' '
378 test_config rebase.autostash true &&
377 - test_pull_autostash --rebase --autostash
379 + test_pull_autostash 1 --rebase --autostash
380 '
381
382 test_expect_success 'pull --rebase --autostash & rebase.autostash=false' '
383 test_config rebase.autostash false &&
382 - test_pull_autostash --rebase --autostash
384 + test_pull_autostash 1 --rebase --autostash
385 '
386
387 test_expect_success 'pull --rebase --autostash & rebase.autostash unset' '
388 test_unconfig rebase.autostash &&
387 - test_pull_autostash --rebase --autostash
389 + test_pull_autostash 1 --rebase --autostash
390 '
391
392 test_expect_success 'pull --rebase --no-autostash & rebase.autostash=true' '
@@ -422,7 +424,7 @@ test_expect_success 'pull.rebase' '
424
425 test_expect_success 'pull --autostash & pull.rebase=true' '
426 test_config pull.rebase true &&
425 - test_pull_autostash --autostash
427 + test_pull_autostash 1 --autostash
428 '
429
430 test_expect_success 'pull --no-autostash & pull.rebase=true' '