Signed-off-by: Felipe Contreras <felipe.contre...@gmail.com> --- Documentation/git-pull.txt | 2 +- git-pull.sh | 15 +++------------ t/t4013-diff-various.sh | 2 +- t/t5500-fetch-pack.sh | 2 +- t/t5520-pull.sh | 5 +---- t/t5524-pull-msg.sh | 2 +- t/t5700-clone-reference.sh | 4 ++-- t/t6022-merge-rename.sh | 20 ++++++++++---------- t/t6026-merge-attr.sh | 2 +- t/t6029-merge-subtree.sh | 6 +++--- t/t6037-merge-ours-theirs.sh | 10 +++++----- 11 files changed, 29 insertions(+), 41 deletions(-)
diff --git a/Documentation/git-pull.txt b/Documentation/git-pull.txt index fe3d15d..968315c 100644 --- a/Documentation/git-pull.txt +++ b/Documentation/git-pull.txt @@ -61,7 +61,7 @@ However, a non-fast-foward case looks very different. origin/master in your repository ------------ -By default `git pull` will warn about these situations, however, most likely +By default `git pull` will fail on these situations, however, most likely you would want to force a merge, which you can do with `git pull --merge`. Then "`git pull`" will fetch and replay the changes from the remote diff --git a/git-pull.sh b/git-pull.sh index c4a0b08..bccaf27 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -78,7 +78,7 @@ then rebase=$(bool_or_string_config pull.rebase) fi fi -test -z "$mode" && mode=default +test -z "$mode" && mode=ff-only dry_run= while : do @@ -317,22 +317,13 @@ case "$merge_head" in *) # check if a non-fast-foward merge would be needed merge_head=${merge_head% } - if test -z "$no_ff$ff_only${squash#--no-squash}" && + if test "$mode" = 'ff-only' && test -z "$no_ff$ff_only${squash#--no-squash}" && test -n "$orig_head" && ! git merge-base --is-ancestor "$orig_head" "$merge_head" && ! git merge-base --is-ancestor "$merge_head" "$orig_head" then - case "$mode" in - ff-only) - die "$(gettext "The pull was not fast-forward, please either merge or rebase. + die "$(gettext "The pull was not fast-forward, please either merge or rebase. If unsure, run 'git pull --merge'.")" - ;; - default) - warn "$(gettext "the pull was not fast-forward, in the future you would have to choose -a merge or a rebase, falling back to old style for now (git pull --merge). -Read 'git pull --help' for more information.")" >&2 - ;; - esac fi ;; esac diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index e77c09c..1840767 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -64,7 +64,7 @@ test_expect_success setup ' export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && git checkout master && - git pull -s ours . side && + git pull --merge -s ours . side && GIT_AUTHOR_DATE="2006-06-26 00:05:00 +0000" && GIT_COMMITTER_DATE="2006-06-26 00:05:00 +0000" && diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 5b2b1c2..f735cfe 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -259,7 +259,7 @@ test_expect_success 'clone shallow object count' ' test_expect_success 'pull in shallow repo with missing merge base' ' ( cd shallow && - test_must_fail git pull --depth 4 .. A + test_must_fail git pull --merge --depth 4 .. A ) ' diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index c96834e..dc7749b 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -409,10 +409,7 @@ test_expect_success 'git pull non-fast-forward (default)' ' git commit -m new && git checkout -b test -t other && git reset --hard master && - git pull 2> error && - cat error && - grep -q "the pull was not fast-forward" error && - grep -q "in the future you would have to choose" error + test_must_fail git pull ' test_done diff --git a/t/t5524-pull-msg.sh b/t/t5524-pull-msg.sh index 8cccecc..ec9f413 100755 --- a/t/t5524-pull-msg.sh +++ b/t/t5524-pull-msg.sh @@ -25,7 +25,7 @@ test_expect_success setup ' test_expect_success pull ' ( cd cloned && - git pull --log && + git pull --merge --log && git log -2 && git cat-file commit HEAD >result && grep Dollar result diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh index 6537911..306badf 100755 --- a/t/t5700-clone-reference.sh +++ b/t/t5700-clone-reference.sh @@ -94,7 +94,7 @@ cd "$base_dir" test_expect_success 'pulling changes from origin' \ 'cd C && -git pull origin' +git pull --merge origin' cd "$base_dir" @@ -109,7 +109,7 @@ cd "$base_dir" test_expect_success 'pulling changes from origin' \ 'cd D && -git pull origin' +git pull --merge origin' cd "$base_dir" diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh index a89dfbe..f63300f 100755 --- a/t/t6022-merge-rename.sh +++ b/t/t6022-merge-rename.sh @@ -100,7 +100,7 @@ git checkout master' test_expect_success 'pull renaming branch into unrenaming one' \ ' git show-branch && - test_expect_code 1 git pull . white && + test_expect_code 1 git pull --merge . white && git ls-files -s && git ls-files -u B >b.stages && test_line_count = 3 b.stages && @@ -118,7 +118,7 @@ test_expect_success 'pull renaming branch into another renaming one' \ rm -f B && git reset --hard && git checkout red && - test_expect_code 1 git pull . white && + test_expect_code 1 git pull --merge . white && git ls-files -u B >b.stages && test_line_count = 3 b.stages && git ls-files -s N >n.stages && @@ -134,7 +134,7 @@ test_expect_success 'pull unrenaming branch into renaming one' \ ' git reset --hard && git show-branch && - test_expect_code 1 git pull . master && + test_expect_code 1 git pull --merge . master && git ls-files -u B >b.stages && test_line_count = 3 b.stages && git ls-files -s N >n.stages && @@ -150,7 +150,7 @@ test_expect_success 'pull conflicting renames' \ ' git reset --hard && git show-branch && - test_expect_code 1 git pull . blue && + test_expect_code 1 git pull --merge . blue && git ls-files -u A >a.stages && test_line_count = 1 a.stages && git ls-files -u B >b.stages && @@ -170,7 +170,7 @@ test_expect_success 'interference with untracked working tree file' ' git reset --hard && git show-branch && echo >A this file should not matter && - test_expect_code 1 git pull . white && + test_expect_code 1 git pull --merge . white && test_path_is_file A ' @@ -180,7 +180,7 @@ test_expect_success 'interference with untracked working tree file' ' git show-branch && rm -f A && echo >A this file should not matter && - test_expect_code 1 git pull . red && + test_expect_code 1 git pull --merge . red && test_path_is_file A ' @@ -190,7 +190,7 @@ test_expect_success 'interference with untracked working tree file' ' git checkout -f master && git tag -f anchor && git show-branch && - git pull . yellow && + git pull --merge . yellow && test_path_is_missing M && git reset --hard anchor ' @@ -203,7 +203,7 @@ test_expect_success 'updated working tree file should prevent the merge' ' git show-branch && echo >>M one line addition && cat M >M.saved && - test_expect_code 128 git pull . yellow && + test_expect_code 128 git pull --merge . yellow && test_cmp M M.saved && rm -f M.saved ' @@ -217,7 +217,7 @@ test_expect_success 'updated working tree file should prevent the merge' ' echo >>M one line addition && cat M >M.saved && git update-index M && - test_expect_code 128 git pull . yellow && + test_expect_code 128 git pull --merge . yellow && test_cmp M M.saved && rm -f M.saved ' @@ -229,7 +229,7 @@ test_expect_success 'interference with untracked working tree file' ' git tag -f anchor && git show-branch && echo >M this file should not matter && - git pull . master && + git pull --merge . master && test_path_is_file M && ! { git ls-files -s | diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh index 5e43997..5428f19 100755 --- a/t/t6026-merge-attr.sh +++ b/t/t6026-merge-attr.sh @@ -172,7 +172,7 @@ test_expect_success 'up-to-date merge without common ancestor' ' test_tick && ( cd repo1 && - git pull ../repo2 master + git pull --merge ../repo2 master ) ' diff --git a/t/t6029-merge-subtree.sh b/t/t6029-merge-subtree.sh index 73fc240..0e626d1 100755 --- a/t/t6029-merge-subtree.sh +++ b/t/t6029-merge-subtree.sh @@ -69,7 +69,7 @@ test_expect_success 'merge update' ' git checkout -b master2 && git commit -m "update git-gui" && cd ../git && - git pull -s subtree gui master2 && + git pull --merge -s subtree gui master2 && git ls-files -s >actual && ( echo "100644 $o3 0 git-gui/git-gui.sh" @@ -98,7 +98,7 @@ test_expect_success 'initial ambiguous subtree' ' test_expect_success 'merge using explicit' ' cd ../git && git reset --hard master2 && - git pull -Xsubtree=git-gui gui master2 && + git pull --merge -Xsubtree=git-gui gui master2 && git ls-files -s >actual && ( echo "100644 $o3 0 git-gui/git-gui.sh" @@ -111,7 +111,7 @@ test_expect_success 'merge using explicit' ' test_expect_success 'merge2 using explicit' ' cd ../git && git reset --hard master2 && - git pull -Xsubtree=git-gui2 gui master2 && + git pull --merge -Xsubtree=git-gui2 gui master2 && git ls-files -s >actual && ( echo "100644 $o1 0 git-gui/git-gui.sh" diff --git a/t/t6037-merge-ours-theirs.sh b/t/t6037-merge-ours-theirs.sh index 3889eca..8e67d2a 100755 --- a/t/t6037-merge-ours-theirs.sh +++ b/t/t6037-merge-ours-theirs.sh @@ -66,11 +66,11 @@ test_expect_success 'binary file with -Xours/-Xtheirs' ' ' test_expect_success 'pull passes -X to underlying merge' ' - git reset --hard master && git pull -s recursive -Xours . side && - git reset --hard master && git pull -s recursive -X ours . side && - git reset --hard master && git pull -s recursive -Xtheirs . side && - git reset --hard master && git pull -s recursive -X theirs . side && - git reset --hard master && test_must_fail git pull -s recursive -X bork . side + git reset --hard master && git pull -m -s recursive -Xours . side && + git reset --hard master && git pull -m -s recursive -X ours . side && + git reset --hard master && git pull -m -s recursive -Xtheirs . side && + git reset --hard master && git pull -m -s recursive -X theirs . side && + git reset --hard master && test_must_fail git pull -m -s recursive -X bork . side ' test_done -- 1.9.2+fc1.19.g85b6256 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html