t1400: make test debuggable.
I had a hard time figuring out why this test was failing with the packed-refs update without running it under "sh -x". This makes output from "sh t1400-update-ref.sh -v" more descriptive. Updating other tests would be a good janitorial task. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Sep 16, 2006 at 13:41 UTC
8aac4b45f39a7c845848a75ac971717a1933d99f
1 file changed
+43
-43
t/t1400-update-ref.sh
+43
-43
@@ -19,51 +19,51 @@ n=$n_dir/fixes
19
20
test_expect_success \
21
"create $m" \
22
- 'git-update-ref $m $A &&
23
- test $A = $(cat .git/$m)'
22
+ "git-update-ref $m $A &&
23
+ test $A"' = $(cat .git/'"$m"')'
24
test_expect_success \
25
"create $m" \
26
- 'git-update-ref $m $B $A &&
27
- test $B = $(cat .git/$m)'
26
+ "git-update-ref $m $B $A &&
27
+ test $B"' = $(cat .git/'"$m"')'
28
rm -f .git/$m
29
30
test_expect_success \
31
"fail to create $n" \
32
- 'touch .git/$n_dir
32
+ "touch .git/$n_dir
33
git-update-ref $n $A >out 2>err
34
- test $? = 1 &&
34
+ test "'$? = 1 &&
35
test "" = "$(cat out)" &&
36
grep "error: unable to resolve reference" err &&
37
- grep $n err'
37
+ grep '"$n err"
38
rm -f .git/$n_dir out err
39
40
test_expect_success \
41
"create $m (by HEAD)" \
42
- 'git-update-ref HEAD $A &&
43
- test $A = $(cat .git/$m)'
42
+ "git-update-ref HEAD $A &&
43
+ test $A"' = $(cat .git/'"$m"')'
44
test_expect_success \
45
"create $m (by HEAD)" \
46
- 'git-update-ref HEAD $B $A &&
47
- test $B = $(cat .git/$m)'
46
+ "git-update-ref HEAD $B $A &&
47
+ test $B"' = $(cat .git/'"$m"')'
48
rm -f .git/$m
49
50
test_expect_failure \
51
'(not) create HEAD with old sha1' \
52
- 'git-update-ref HEAD $A $B'
52
+ "git-update-ref HEAD $A $B"
53
test_expect_failure \
54
"(not) prior created .git/$m" \
55
- 'test -f .git/$m'
55
+ "test -f .git/$m"
56
rm -f .git/$m
57
58
test_expect_success \
59
"create HEAD" \
60
- 'git-update-ref HEAD $A'
60
+ "git-update-ref HEAD $A"
61
test_expect_failure \
62
'(not) change HEAD with wrong SHA1' \
63
- 'git-update-ref HEAD $B $Z'
63
+ "git-update-ref HEAD $B $Z"
64
test_expect_failure \
65
"(not) changed .git/$m" \
66
- 'test $B = $(cat .git/$m)'
66
+ "test $B"' = $(cat .git/'"$m"')'
67
rm -f .git/$m
68
69
mkdir -p .git/logs/refs/heads
@@ -71,18 +71,18 @@ touch .git/logs/refs/heads/master
71
test_expect_success \
72
"create $m (logged by touch)" \
73
'GIT_COMMITTER_DATE="2005-05-26 23:30" \
74
- git-update-ref HEAD $A -m "Initial Creation" &&
75
- test $A = $(cat .git/$m)'
74
+ git-update-ref HEAD '"$A"' -m "Initial Creation" &&
75
+ test '"$A"' = $(cat .git/'"$m"')'
76
test_expect_success \
77
"update $m (logged by touch)" \
78
'GIT_COMMITTER_DATE="2005-05-26 23:31" \
79
- git-update-ref HEAD $B $A -m "Switch" &&
80
- test $B = $(cat .git/$m)'
79
+ git-update-ref HEAD'" $B $A "'-m "Switch" &&
80
+ test '"$B"' = $(cat .git/'"$m"')'
81
test_expect_success \
82
"set $m (logged by touch)" \
83
'GIT_COMMITTER_DATE="2005-05-26 23:41" \
84
- git-update-ref HEAD $A &&
85
- test $A = $(cat .git/$m)'
84
+ git-update-ref HEAD'" $A &&
85
+ test $A"' = $(cat .git/'"$m"')'
86
87
cat >expect <<EOF
88
$Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 Initial Creation
@@ -91,7 +91,7 @@ $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000
91
EOF
92
test_expect_success \
93
"verifying $m's log" \
94
- 'diff expect .git/logs/$m'
94
+ "diff expect .git/logs/$m"
95
rm -rf .git/$m .git/logs expect
96
97
test_expect_success \
@@ -102,18 +102,18 @@ test_expect_success \
102
test_expect_success \
103
"create $m (logged by config)" \
104
'GIT_COMMITTER_DATE="2005-05-26 23:32" \
105
- git-update-ref HEAD $A -m "Initial Creation" &&
106
- test $A = $(cat .git/$m)'
105
+ git-update-ref HEAD'" $A "'-m "Initial Creation" &&
106
+ test '"$A"' = $(cat .git/'"$m"')'
107
test_expect_success \
108
"update $m (logged by config)" \
109
'GIT_COMMITTER_DATE="2005-05-26 23:33" \
110
- git-update-ref HEAD $B $A -m "Switch" &&
111
- test $B = $(cat .git/$m)'
110
+ git-update-ref HEAD'" $B $A "'-m "Switch" &&
111
+ test '"$B"' = $(cat .git/'"$m"')'
112
test_expect_success \
113
"set $m (logged by config)" \
114
'GIT_COMMITTER_DATE="2005-05-26 23:43" \
115
- git-update-ref HEAD $A &&
116
- test $A = $(cat .git/$m)'
115
+ git-update-ref HEAD '"$A &&
116
+ test $A"' = $(cat .git/'"$m"')'
117
118
cat >expect <<EOF
119
$Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 +0000 Initial Creation
@@ -140,50 +140,50 @@ test_expect_success \
140
'Query "master@{May 25 2005}" (before history)' \
141
'rm -f o e
142
git-rev-parse --verify "master@{May 25 2005}" >o 2>e &&
143
- test $C = $(cat o) &&
144
- test "warning: Log .git/logs/$m only goes back to $ed." = "$(cat e)"'
143
+ test '"$C"' = $(cat o) &&
144
+ test "warning: Log .git/logs/'"$m only goes back to $ed"'." = "$(cat e)"'
145
test_expect_success \
146
"Query master@{2005-05-25} (before history)" \
147
'rm -f o e
148
git-rev-parse --verify master@{2005-05-25} >o 2>e &&
149
- test $C = $(cat o) &&
150
- echo test "warning: Log .git/logs/$m only goes back to $ed." = "$(cat e)"'
149
+ test '"$C"' = $(cat o) &&
150
+ echo test "warning: Log .git/logs/'"$m only goes back to $ed"'." = "$(cat e)"'
151
test_expect_success \
152
'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \
153
'rm -f o e
154
git-rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e &&
155
- test $C = $(cat o) &&
156
- test "warning: Log .git/logs/$m only goes back to $ed." = "$(cat e)"'
155
+ test '"$C"' = $(cat o) &&
156
+ test "warning: Log .git/logs/'"$m only goes back to $ed"'." = "$(cat e)"'
157
test_expect_success \
158
'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \
159
'rm -f o e
160
git-rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
161
- test $A = $(cat o) &&
161
+ test '"$A"' = $(cat o) &&
162
test "" = "$(cat e)"'
163
test_expect_success \
164
'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \
165
'rm -f o e
166
git-rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e &&
167
- test $B = $(cat o) &&
168
- test "warning: Log .git/logs/$m has gap after $gd." = "$(cat e)"'
167
+ test '"$B"' = $(cat o) &&
168
+ test "warning: Log .git/logs/'"$m has gap after $gd"'." = "$(cat e)"'
169
test_expect_success \
170
'Query "master@{2005-05-26 23:38:00}" (middle of history)' \
171
'rm -f o e
172
git-rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
173
- test $Z = $(cat o) &&
173
+ test '"$Z"' = $(cat o) &&
174
test "" = "$(cat e)"'
175
test_expect_success \
176
'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \
177
'rm -f o e
178
git-rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
179
- test $E = $(cat o) &&
179
+ test '"$E"' = $(cat o) &&
180
test "" = "$(cat e)"'
181
test_expect_success \
182
'Query "master@{2005-05-28}" (past end of history)' \
183
'rm -f o e
184
git-rev-parse --verify "master@{2005-05-28}" >o 2>e &&
185
- test $D = $(cat o) &&
186
- test "warning: Log .git/logs/$m unexpectedly ended on $ld." = "$(cat e)"'
185
+ test '"$D"' = $(cat o) &&
186
+ test "warning: Log .git/logs/'"$m unexpectedly ended on $ld"'." = "$(cat e)"'
187
188
189
rm -f .git/$m .git/logs/$m expect
@@ -221,7 +221,7 @@ $h_FIXED $h_MERGED $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117151100 +0000 c
221
EOF
222
test_expect_success \
223
'git-commit logged updates' \
224
- 'diff expect .git/logs/$m'
224
+ "diff expect .git/logs/$m"
225
unset h_TEST h_OTHER h_FIXED h_MERGED
226
227
test_expect_success \