Skip to content

Commit f8a1785

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a03b555 commit f8a1785

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

t/t5520-pull.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ modify () {
1010
}
1111

1212
test_pull_autostash () {
13+
expect_parent_num="$1" &&
14+
shift &&
1315
git reset --hard before-rebase &&
1416
echo dirty >new_file &&
1517
git add new_file &&
1618
git pull "$@" . copy &&
17-
test_cmp_rev HEAD^ copy &&
19+
test_cmp_rev HEAD^"$expect_parent_num" copy &&
1820
echo dirty >expect &&
1921
test_cmp expect new_file &&
2022
echo "modified again" >expect &&
@@ -369,22 +371,22 @@ test_expect_success '--rebase fails with multiple branches' '
369371

370372
test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '
371373
test_config rebase.autostash true &&
372-
test_pull_autostash --rebase
374+
test_pull_autostash 1 --rebase
373375
'
374376

375377
test_expect_success 'pull --rebase --autostash & rebase.autostash=true' '
376378
test_config rebase.autostash true &&
377-
test_pull_autostash --rebase --autostash
379+
test_pull_autostash 1 --rebase --autostash
378380
'
379381

380382
test_expect_success 'pull --rebase --autostash & rebase.autostash=false' '
381383
test_config rebase.autostash false &&
382-
test_pull_autostash --rebase --autostash
384+
test_pull_autostash 1 --rebase --autostash
383385
'
384386

385387
test_expect_success 'pull --rebase --autostash & rebase.autostash unset' '
386388
test_unconfig rebase.autostash &&
387-
test_pull_autostash --rebase --autostash
389+
test_pull_autostash 1 --rebase --autostash
388390
'
389391

390392
test_expect_success 'pull --rebase --no-autostash & rebase.autostash=true' '
@@ -422,7 +424,7 @@ test_expect_success 'pull.rebase' '
422424

423425
test_expect_success 'pull --autostash & pull.rebase=true' '
424426
test_config pull.rebase true &&
425-
test_pull_autostash --autostash
427+
test_pull_autostash 1 --autostash
426428
'
427429

428430
test_expect_success 'pull --no-autostash & pull.rebase=true' '

0 commit comments

Comments
 (0)