Skip to content

Commit

Permalink
pull: add t5572 for submodule updates
Browse files Browse the repository at this point in the history
Test that the pull command updates the work tree as expected (for
submodule changes which don't result in conflicts) when used without
arguments or with the '--ff', '--ff-only' and '--no-ff' flag each. Add
helper functions to reset the branch to be updated to to the current
HEAD so that pull is doing the transition from HEAD to the given branch.

Set KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES
and KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR to
document that pull has the same --no-ff known failures merge has.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jens Lehmann authored and Junio C Hamano committed Jul 14, 2014
1 parent c7e6916 commit 921f50b
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions t/t5572-pull-submodule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/sh

test_description='pull can handle submodules'

. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-submodule-update.sh

reset_branch_to_HEAD () {
git branch -D "$1" &&
git checkout -b "$1" HEAD &&
git branch --set-upstream-to="origin/$1" "$1"
}

git_pull () {
reset_branch_to_HEAD "$1" &&
git pull
}

# pulls without conflicts
test_submodule_switch "git_pull"

git_pull_ff () {
reset_branch_to_HEAD "$1" &&
git pull --ff
}

test_submodule_switch "git_pull_ff"

git_pull_ff_only () {
reset_branch_to_HEAD "$1" &&
git pull --ff-only
}

test_submodule_switch "git_pull_ff_only"

git_pull_noff () {
reset_branch_to_HEAD "$1" &&
git pull --no-ff
}

KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1
KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1
test_submodule_switch "git_pull_noff"

test_done

0 comments on commit 921f50b

Please sign in to comment.