git-svn: reduce stat() calls for a backwards compatibility check
[git/dscho.git] / t / t5516-fetch-push.sh
blobdba018f667048d7bd5233136dfe70ee0f1305a9a
1 #!/bin/sh
3 test_description='fetching and pushing, with or without wildcard'
5 . ./test-lib.sh
7 D=`pwd`
9 mk_empty () {
10 rm -fr testrepo &&
11 mkdir testrepo &&
13 cd testrepo &&
14 git init
18 test_expect_success setup '
20 : >path1 &&
21 git add path1 &&
22 test_tick &&
23 git commit -a -m repo &&
24 the_commit=$(git show-ref -s --verify refs/heads/master)
28 test_expect_success 'fetch without wildcard' '
29 mk_empty &&
31 cd testrepo &&
32 git fetch .. refs/heads/master:refs/remotes/origin/master &&
34 r=$(git show-ref -s --verify refs/remotes/origin/master) &&
35 test "z$r" = "z$the_commit" &&
37 test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
41 test_expect_success 'fetch with wildcard' '
42 mk_empty &&
44 cd testrepo &&
45 git config remote.up.url .. &&
46 git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
47 git fetch up &&
49 r=$(git show-ref -s --verify refs/remotes/origin/master) &&
50 test "z$r" = "z$the_commit" &&
52 test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
56 test_expect_success 'push without wildcard' '
57 mk_empty &&
59 git push testrepo refs/heads/master:refs/remotes/origin/master &&
61 cd testrepo &&
62 r=$(git show-ref -s --verify refs/remotes/origin/master) &&
63 test "z$r" = "z$the_commit" &&
65 test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
69 test_expect_success 'push with wildcard' '
70 mk_empty &&
72 git push testrepo "refs/heads/*:refs/remotes/origin/*" &&
74 cd testrepo &&
75 r=$(git show-ref -s --verify refs/remotes/origin/master) &&
76 test "z$r" = "z$the_commit" &&
78 test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
82 test_done