Merge branch 'jl/fix-test'
authorJunio C Hamano <gitster@pobox.com>
Wed, 15 Sep 2010 19:40:12 +0000 (12:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Sep 2010 19:40:12 +0000 (12:40 -0700)
* jl/fix-test:
t1020: Get rid of 'cd "$HERE"' at the start of each test
t2016 (checkout -p): add missing &&
t1302 (core.repositoryversion): style tweaks
t2105 (gitfile): add missing &&
t1450 (fsck): remove dangling objects
tests: subshell indentation stylefix
Several tests: cd inside subshell instead of around

1  2 
t/t5510-fetch.sh
diff --combined t/t5510-fetch.sh
index efb42d154035fa8abdc10874151048c5e73546fa,7d1c866e13fb8992329369a5f72c2d28af557fd1..9a884751ec73ff721d658ebb69cbfe1f0270be85
@@@ -21,27 -21,30 +21,30 @@@ test_expect_success setup 
  
  test_expect_success "clone and setup child repos" '
        git clone . one &&
-       cd one &&
-       echo >file updated by one &&
-       git commit -a -m "updated by one" &&
-       cd .. &&
+       (
+               cd one &&
+               echo >file updated by one &&
+               git commit -a -m "updated by one"
+       ) &&
        git clone . two &&
-       cd two &&
-       git config branch.master.remote one &&
-       git config remote.one.url ../one/.git/ &&
-       git config remote.one.fetch refs/heads/master:refs/heads/one &&
-       cd .. &&
+       (
+               cd two &&
+               git config branch.master.remote one &&
+               git config remote.one.url ../one/.git/ &&
+               git config remote.one.fetch refs/heads/master:refs/heads/one
+       ) &&
        git clone . three &&
-       cd three &&
-       git config branch.master.remote two &&
-       git config branch.master.merge refs/heads/one &&
-       mkdir -p .git/remotes &&
-       {
-               echo "URL: ../two/.git/"
-               echo "Pull: refs/heads/master:refs/heads/two"
-               echo "Pull: refs/heads/one:refs/heads/one"
-       } >.git/remotes/two &&
-       cd .. &&
+       (
+               cd three &&
+               git config branch.master.remote two &&
+               git config branch.master.merge refs/heads/one &&
+               mkdir -p .git/remotes &&
+               {
+                       echo "URL: ../two/.git/"
+                       echo "Pull: refs/heads/master:refs/heads/two"
+                       echo "Pull: refs/heads/one:refs/heads/one"
+               } >.git/remotes/two
+       ) &&
        git clone . bundle &&
        git clone . seven
  '
@@@ -240,38 -243,6 +243,38 @@@ test_expect_success 'fetch with a non-a
        git fetch blub
  '
  
 +# 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 &&
 +      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
  test_expect_success 'quoting of a strangely named repo' '
        test_must_fail git fetch "a\\!'\''b" > result 2>&1 &&