diff options
Diffstat (limited to 't/t5520-pull.sh')
-rwxr-xr-x | t/t5520-pull.sh | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 0818080..47534f1 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -31,7 +31,7 @@ test_pull_autostash_fail () { echo dirty >new_file && git add new_file && test_must_fail git pull "$@" . copy 2>err && - test_i18ngrep -E "uncommitted changes.|overwritten by merge:" err + test_grep -E "uncommitted changes.|overwritten by merge:" err } test_expect_success setup ' @@ -151,7 +151,7 @@ test_expect_success 'fail if wildcard spec does not match any refs' ' echo file >expect && test_cmp expect file && test_must_fail git pull . "refs/nonexisting1/*:refs/nonexisting2/*" 2>err && - test_i18ngrep "no candidates for merging" err && + test_grep "no candidates for merging" err && test_cmp expect file ' @@ -164,7 +164,7 @@ test_expect_success 'fail if no branches specified with non-default remote' ' test_cmp expect file && test_config branch.test.remote origin && test_must_fail git pull test_remote 2>err && - test_i18ngrep "specify a branch on the command line" err && + test_grep "specify a branch on the command line" err && test_cmp expect file ' @@ -176,7 +176,7 @@ test_expect_success 'fail if not on a branch' ' echo file >expect && test_cmp expect file && test_must_fail git pull 2>err && - test_i18ngrep "not currently on a branch" err && + test_grep "not currently on a branch" err && test_cmp expect file ' @@ -189,7 +189,7 @@ test_expect_success 'fail if no configuration for current branch' ' echo file >expect && test_cmp expect file && test_must_fail git pull 2>err && - test_i18ngrep "no tracking information" err && + test_grep "no tracking information" err && test_cmp expect file ' @@ -202,7 +202,7 @@ test_expect_success 'pull --all: fail if no configuration for current branch' ' echo file >expect && test_cmp expect file && test_must_fail git pull --all 2>err && - test_i18ngrep "There is no tracking information" err && + test_grep "There is no tracking information" err && test_cmp expect file ' @@ -214,10 +214,27 @@ test_expect_success 'fail if upstream branch does not exist' ' echo file >expect && test_cmp expect file && test_must_fail git pull 2>err && - test_i18ngrep "no such ref was fetched" err && + test_grep "no such ref was fetched" err && test_cmp expect file ' +test_expect_success 'fetch upstream branch even if refspec excludes it' ' + # the branch names are not important here except that + # the first one must not be a prefix of the second, + # since otherwise the ref-prefix protocol extension + # would match both + git branch in-refspec HEAD^ && + git branch not-in-refspec HEAD && + git init -b in-refspec downstream && + git -C downstream remote add -t in-refspec origin "file://$(pwd)/.git" && + git -C downstream config branch.in-refspec.remote origin && + git -C downstream config branch.in-refspec.merge refs/heads/not-in-refspec && + git -C downstream pull && + git rev-parse --verify not-in-refspec >expect && + git -C downstream rev-parse --verify HEAD >actual && + test_cmp expect actual +' + test_expect_success 'fail if the index has unresolved entries' ' git checkout -b third second^ && test_when_finished "git checkout -f copy && git branch -D third" && @@ -231,13 +248,13 @@ test_expect_success 'fail if the index has unresolved entries' ' test_file_not_empty unmerged && cp file expected && test_must_fail git pull . second 2>err && - test_i18ngrep "Pulling is not possible because you have unmerged files." err && + test_grep "Pulling is not possible because you have unmerged files." err && test_cmp expected file && git add file && git ls-files -u >unmerged && test_must_be_empty unmerged && test_must_fail git pull . second 2>err && - test_i18ngrep "You have not concluded your merge" err && + test_grep "You have not concluded your merge" err && test_cmp expected file ' @@ -247,7 +264,7 @@ test_expect_success 'fast-forwards working tree if branch head is updated' ' echo file >expect && test_cmp expect file && git pull . second:third 2>err && - test_i18ngrep "fetch updated the current branch head" err && + test_grep "fetch updated the current branch head" err && echo modified >expect && test_cmp expect file && test_cmp_rev third second @@ -260,7 +277,7 @@ test_expect_success 'fast-forward fails with conflicting work tree' ' test_cmp expect file && echo conflict >file && test_must_fail git pull . second:third 2>err && - test_i18ngrep "Cannot fast-forward your working tree" err && + test_grep "Cannot fast-forward your working tree" err && echo conflict >expect && test_cmp expect file && test_cmp_rev third second @@ -358,7 +375,7 @@ test_expect_success '--rebase with conflicts shows advice' ' test_tick && git commit -m "Create conflict" seq.txt && test_must_fail git pull --rebase . seq 2>err >out && - test_i18ngrep "Resolve all conflicts manually" err + test_grep "Resolve all conflicts manually" err ' test_expect_success 'failed --rebase shows advice' ' @@ -372,14 +389,14 @@ test_expect_success 'failed --rebase shows advice' ' git checkout -f -b fails-to-rebase HEAD^ && test_commit v2-without-cr file "2" file2-lf && test_must_fail git pull --rebase . diverging 2>err >out && - test_i18ngrep "Resolve all conflicts manually" err + test_grep "Resolve all conflicts manually" err ' test_expect_success '--rebase fails with multiple branches' ' git reset --hard before-rebase && test_must_fail git pull --rebase . copy main 2>err && test_cmp_rev HEAD before-rebase && - test_i18ngrep "Cannot rebase onto multiple branches" err && + test_grep "Cannot rebase onto multiple branches" err && echo modified >expect && git show HEAD:file >actual && test_cmp expect actual @@ -503,7 +520,7 @@ test_expect_success 'pull --rebase warns on --verify-signatures' ' echo new >expect && git show HEAD:file2 >actual && test_cmp expect actual && - test_i18ngrep "ignoring --verify-signatures for rebase" err + test_grep "ignoring --verify-signatures for rebase" err ' test_expect_success 'pull --rebase does not warn on --no-verify-signatures' ' @@ -513,7 +530,7 @@ test_expect_success 'pull --rebase does not warn on --no-verify-signatures' ' echo new >expect && git show HEAD:file2 >actual && test_cmp expect actual && - test_i18ngrep ! "verify-signatures" err + test_grep ! "verify-signatures" err ' # add a feature branch, keep-merge, that is merged into main, so the @@ -723,7 +740,7 @@ test_expect_success 'pull --rebase fails on unborn branch with staged changes' ' test_cmp expect actual && git show :staged-file >actual && test_cmp expect actual && - test_i18ngrep "unborn branch with changes added to the index" err + test_grep "unborn branch with changes added to the index" err ) ' |