rev-parse --glob
[git/git.git] / t / t6018-rev-list-glob.sh
1 #!/bin/sh
2
3 test_description='rev-list/rev-parse --glob'
4
5 . ./test-lib.sh
6
7 commit () {
8 test_tick &&
9 echo $1 > foo &&
10 git add foo &&
11 git commit -m "$1"
12 }
13
14 compare () {
15 # Split arguments on whitespace.
16 git $1 $2 >expected &&
17 git $1 $3 >actual &&
18 test_cmp expected actual
19 }
20
21 test_expect_success 'setup' '
22
23 commit master &&
24 git checkout -b subspace/one master &&
25 commit one &&
26 git checkout -b subspace/two master &&
27 commit two &&
28 git checkout -b subspace-x master &&
29 commit subspace-x &&
30 git checkout -b other/three master &&
31 commit three &&
32 git checkout -b someref master &&
33 commit some &&
34 git checkout master &&
35 commit master2
36 '
37
38 test_expect_success 'rev-parse --glob=refs/heads/subspace/*' '
39
40 compare rev-parse "subspace/one subspace/two" "--glob=refs/heads/subspace/*"
41
42 '
43
44 test_expect_success 'rev-parse --glob=heads/subspace/*' '
45
46 compare rev-parse "subspace/one subspace/two" "--glob=heads/subspace/*"
47
48 '
49
50 test_expect_success 'rev-parse --glob=refs/heads/subspace/' '
51
52 compare rev-parse "subspace/one subspace/two" "--glob=refs/heads/subspace/"
53
54 '
55
56 test_expect_success 'rev-parse --glob=heads/subspace/' '
57
58 compare rev-parse "subspace/one subspace/two" "--glob=heads/subspace/"
59
60 '
61
62 test_expect_success 'rev-parse --glob=heads/subspace' '
63
64 compare rev-parse "subspace/one subspace/two" "--glob=heads/subspace"
65
66 '
67
68 test_expect_success 'rev-parse --glob=heads/subspace/* --glob=heads/other/*' '
69
70 compare rev-parse "subspace/one subspace/two other/three" "--glob=heads/subspace/* --glob=heads/other/*"
71
72 '
73
74 test_expect_success 'rev-parse --glob=heads/someref/* master' '
75
76 compare rev-parse "master" "--glob=heads/someref/* master"
77
78 '
79
80 test_expect_success 'rev-parse --glob=heads/*' '
81
82 compare rev-parse "master other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*"
83
84 '
85
86 test_expect_success 'rev-list --glob=refs/heads/subspace/*' '
87
88 compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/*"
89
90 '
91
92 test_expect_success 'rev-list --glob=heads/subspace/*' '
93
94 compare rev-list "subspace/one subspace/two" "--glob=heads/subspace/*"
95
96 '
97
98 test_expect_success 'rev-list --glob=refs/heads/subspace/' '
99
100 compare rev-list "subspace/one subspace/two" "--glob=refs/heads/subspace/"
101
102 '
103
104 test_expect_success 'rev-list --glob=heads/subspace/' '
105
106 compare rev-list "subspace/one subspace/two" "--glob=heads/subspace/"
107
108 '
109
110 test_expect_success 'rev-list --glob=heads/subspace' '
111
112 compare rev-list "subspace/one subspace/two" "--glob=heads/subspace"
113
114 '
115
116 test_expect_success 'rev-list --glob=heads/someref/* master' '
117
118 compare rev-list "master" "--glob=heads/someref/* master"
119
120 '
121
122 test_expect_success 'rev-list --glob=heads/subspace/* --glob=heads/other/*' '
123
124 compare rev-list "subspace/one subspace/two other/three" "--glob=heads/subspace/* --glob=heads/other/*"
125
126 '
127
128 test_expect_success 'rev-list --glob=heads/*' '
129
130 compare rev-list "master other/three someref subspace-x subspace/one subspace/two" "--glob=heads/*"
131
132 '
133
134 test_done