aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Casey <drafnel@gmail.com>2010-09-09 13:56:37 -0500
committerJunio C Hamano <gitster@pobox.com>2010-09-09 17:16:08 -0700
commit042cca38866569ca8a64c6ef1f95c58b157e4d36 (patch)
treeecc11c8b8d4666ee52cd02184391653109787b99
parentf31dbdc7dad3511e1ee73cb04a032773d11231cd (diff)
downloadgit-042cca38866569ca8a64c6ef1f95c58b157e4d36.tar.gz
git-042cca38866569ca8a64c6ef1f95c58b157e4d36.tar.xz
t/t5510-fetch.sh: improve testing with explicit URL and merge spec
Commit 6106ce46 introduced a test to demonstrate fetch's failure to retrieve any objects or update FETCH_HEAD when it was supplied a repository URL and the current branch had a configured merge spec. This commit expands the original test based on comments from Junio Hamano. In addition to actually verifying that the fetch updates FETCH_HEAD correctly, and does not update the current branch, two more tests are added to ensure that the merge configuration is ignored even when the supplied URL matches the URL of the remote configured for the branch. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t5510-fetch.sh30
1 files changed, 28 insertions, 2 deletions
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index 8fbd894e7..efb42d154 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -240,10 +240,36 @@ test_expect_success 'fetch with a non-applying branch.<name>.merge' '
git fetch blub
'
-test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge' '
+# URL supplied to fetch does not match the url of the configured branch's remote
+test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [1]' '
+ one_head=$(cd one && git rev-parse HEAD) &&
+ this_head=$(git rev-parse HEAD) &&
git update-ref -d FETCH_HEAD &&
git fetch one &&
- git rev-parse --verify FETCH_HEAD
+ test $one_head = "$(git rev-parse --verify FETCH_HEAD)" &&
+ test $this_head = "$(git rev-parse --verify HEAD)"
+'
+
+# URL supplied to fetch matches the url of the configured branch's remote and
+# the merge spec matches the branch the remote HEAD points to
+test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [2]' '
+ one_ref=$(cd one && git symbolic-ref HEAD) &&
+ git config branch.master.remote blub &&
+ git config branch.master.merge "$one_ref" &&
+ git update-ref -d FETCH_HEAD &&
+ git fetch one &&
+ test $one_head = "$(git rev-parse --verify FETCH_HEAD)" &&
+ test $this_head = "$(git rev-parse --verify HEAD)"
+'
+
+# URL supplied to fetch matches the url of the configured branch's remote, but
+# the merge spec does not match the branch the remote HEAD points to
+test_expect_success 'fetch from GIT URL with a non-applying branch.<name>.merge [3]' '
+ git config branch.master.merge "${one_ref}_not" &&
+ git update-ref -d FETCH_HEAD &&
+ git fetch one &&
+ test $one_head = "$(git rev-parse --verify FETCH_HEAD)" &&
+ test $this_head = "$(git rev-parse --verify HEAD)"
'
# the strange name is: a\!'b