summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2020-04-07 14:28:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-10 16:28:02 (GMT)
commitf8a178580719a93040a49cf25624f1d56d0147f1 (patch)
tree611961be6b842c0d14e7f28c6392440a0d8a6650
parenta03b55530ab844974b7058042a015fcfcd9e7a53 (diff)
downloadgit-f8a178580719a93040a49cf25624f1d56d0147f1.zip
git-f8a178580719a93040a49cf25624f1d56d0147f1.tar.gz
git-f8a178580719a93040a49cf25624f1d56d0147f1.tar.bz2
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>
-rwxr-xr-xt/t5520-pull.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 2f86fca..f610dc1 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -10,11 +10,13 @@ modify () {
}
test_pull_autostash () {
+ expect_parent_num="$1" &&
+ shift &&
git reset --hard before-rebase &&
echo dirty >new_file &&
git add new_file &&
git pull "$@" . copy &&
- test_cmp_rev HEAD^ copy &&
+ test_cmp_rev HEAD^"$expect_parent_num" copy &&
echo dirty >expect &&
test_cmp expect new_file &&
echo "modified again" >expect &&
@@ -369,22 +371,22 @@ test_expect_success '--rebase fails with multiple branches' '
test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '
test_config rebase.autostash true &&
- test_pull_autostash --rebase
+ test_pull_autostash 1 --rebase
'
test_expect_success 'pull --rebase --autostash & rebase.autostash=true' '
test_config rebase.autostash true &&
- test_pull_autostash --rebase --autostash
+ test_pull_autostash 1 --rebase --autostash
'
test_expect_success 'pull --rebase --autostash & rebase.autostash=false' '
test_config rebase.autostash false &&
- test_pull_autostash --rebase --autostash
+ test_pull_autostash 1 --rebase --autostash
'
test_expect_success 'pull --rebase --autostash & rebase.autostash unset' '
test_unconfig rebase.autostash &&
- test_pull_autostash --rebase --autostash
+ test_pull_autostash 1 --rebase --autostash
'
test_expect_success 'pull --rebase --no-autostash & rebase.autostash=true' '
@@ -422,7 +424,7 @@ test_expect_success 'pull.rebase' '
test_expect_success 'pull --autostash & pull.rebase=true' '
test_config pull.rebase true &&
- test_pull_autostash --autostash
+ test_pull_autostash 1 --autostash
'
test_expect_success 'pull --no-autostash & pull.rebase=true' '