Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2020-04-07 17:28:09 +0300
committerJunio C Hamano <gitster@pobox.com>2020-04-10 19:28:02 +0300
commitd9f15d37f1a545305988f6b2bb40de1fbf0049cf (patch)
tree9ba6f8add9d176addd453d87276c37dba0025f6f /t/t5520-pull.sh
parentf8a178580719a93040a49cf25624f1d56d0147f1 (diff)
pull: pass --autostash to merge
Before, `--autostash` only worked with `git pull --rebase`. However, in the last patch, merge learned `--autostash` as well so there's no reason why we should have this restriction anymore. Teach pull to pass `--autostash` to merge, just like it did for rebase. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5520-pull.sh')
-rwxr-xr-xt/t5520-pull.sh43
1 files changed, 35 insertions, 8 deletions
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index f610dc14de..37535d63a9 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -28,7 +28,7 @@ test_pull_autostash_fail () {
echo dirty >new_file &&
git add new_file &&
test_must_fail git pull "$@" . copy 2>err &&
- test_i18ngrep "uncommitted changes." err
+ test_i18ngrep "\(uncommitted changes.\)\|\(overwritten by merge:\)" err
}
test_expect_success setup '
@@ -404,13 +404,40 @@ test_expect_success 'pull --rebase --no-autostash & rebase.autostash unset' '
test_pull_autostash_fail --rebase --no-autostash
'
-for i in --autostash --no-autostash
-do
- test_expect_success "pull $i (without --rebase) is illegal" '
- test_must_fail git pull $i . copy 2>err &&
- test_i18ngrep "only valid with --rebase" err
- '
-done
+test_expect_success 'pull succeeds with dirty working directory and merge.autostash set' '
+ test_config merge.autostash true &&
+ test_pull_autostash 2
+'
+
+test_expect_success 'pull --autostash & merge.autostash=true' '
+ test_config merge.autostash true &&
+ test_pull_autostash 2 --autostash
+'
+
+test_expect_success 'pull --autostash & merge.autostash=false' '
+ test_config merge.autostash false &&
+ test_pull_autostash 2 --autostash
+'
+
+test_expect_success 'pull --autostash & merge.autostash unset' '
+ test_unconfig merge.autostash &&
+ test_pull_autostash 2 --autostash
+'
+
+test_expect_success 'pull --no-autostash & merge.autostash=true' '
+ test_config merge.autostash true &&
+ test_pull_autostash_fail --no-autostash
+'
+
+test_expect_success 'pull --no-autostash & merge.autostash=false' '
+ test_config merge.autostash false &&
+ test_pull_autostash_fail --no-autostash
+'
+
+test_expect_success 'pull --no-autostash & merge.autostash unset' '
+ test_unconfig merge.autostash &&
+ test_pull_autostash_fail --no-autostash
+'
test_expect_success 'pull.rebase' '
git reset --hard before-rebase &&