Test wildcard push/fetch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jun 8, 2007 at 00:43 UTC
bcdb34f70d59d4e090ef9a34e4b77fe7e5369f3e
1 file changed
+82
t/t5516-fetch-push.sh
new
+82
@@ -0,0 +1,82 @@
1
+#!/bin/sh
2
+
3
+test_description='fetching and pushing, with or without wildcard'
4
+
5
+. ./test-lib.sh
6
+
7
+D=`pwd`
8
+
9
+mk_empty () {
10
+ rm -fr testrepo &&
11
+ mkdir testrepo &&
12
+ (
13
+ cd testrepo &&
14
+ git init
15
+ )
16
+}
17
+
18
+test_expect_success setup '
19
+
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)
25
+
26
+'
27
+
28
+test_expect_success 'fetch without wildcard' '
29
+ mk_empty &&
30
+ (
31
+ cd testrepo &&
32
+ git fetch .. refs/heads/master:refs/remotes/origin/master &&
33
+
34
+ r=$(git show-ref -s --verify refs/remotes/origin/master) &&
35
+ test "z$r" = "z$the_commit" &&
36
+
37
+ test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
38
+ )
39
+'
40
+
41
+test_expect_success 'fetch with wildcard' '
42
+ mk_empty &&
43
+ (
44
+ cd testrepo &&
45
+ git config remote.up.url .. &&
46
+ git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
47
+ git fetch up &&
48
+
49
+ r=$(git show-ref -s --verify refs/remotes/origin/master) &&
50
+ test "z$r" = "z$the_commit" &&
51
+
52
+ test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
53
+ )
54
+'
55
+
56
+test_expect_success 'push without wildcard' '
57
+ mk_empty &&
58
+
59
+ git push testrepo refs/heads/master:refs/remotes/origin/master &&
60
+ (
61
+ cd testrepo &&
62
+ r=$(git show-ref -s --verify refs/remotes/origin/master) &&
63
+ test "z$r" = "z$the_commit" &&
64
+
65
+ test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
66
+ )
67
+'
68
+
69
+test_expect_success 'push with wildcard' '
70
+ mk_empty &&
71
+
72
+ git push testrepo "refs/heads/*:refs/remotes/origin/*" &&
73
+ (
74
+ cd testrepo &&
75
+ r=$(git show-ref -s --verify refs/remotes/origin/master) &&
76
+ test "z$r" = "z$the_commit" &&
77
+
78
+ test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
79
+ )
80
+'
81
+
82
+test_done