Skip to content

Commit 8aac4b4

Browse files
author
Junio C Hamano
committed
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>
1 parent e7676d2 commit 8aac4b4

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

t/t1400-update-ref.sh

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,70 +19,70 @@ n=$n_dir/fixes
1919

2020
test_expect_success \
2121
"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"')'
2424
test_expect_success \
2525
"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"')'
2828
rm -f .git/$m
2929

3030
test_expect_success \
3131
"fail to create $n" \
32-
'touch .git/$n_dir
32+
"touch .git/$n_dir
3333
git-update-ref $n $A >out 2>err
34-
test $? = 1 &&
34+
test "'$? = 1 &&
3535
test "" = "$(cat out)" &&
3636
grep "error: unable to resolve reference" err &&
37-
grep $n err'
37+
grep '"$n err"
3838
rm -f .git/$n_dir out err
3939

4040
test_expect_success \
4141
"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"')'
4444
test_expect_success \
4545
"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"')'
4848
rm -f .git/$m
4949

5050
test_expect_failure \
5151
'(not) create HEAD with old sha1' \
52-
'git-update-ref HEAD $A $B'
52+
"git-update-ref HEAD $A $B"
5353
test_expect_failure \
5454
"(not) prior created .git/$m" \
55-
'test -f .git/$m'
55+
"test -f .git/$m"
5656
rm -f .git/$m
5757

5858
test_expect_success \
5959
"create HEAD" \
60-
'git-update-ref HEAD $A'
60+
"git-update-ref HEAD $A"
6161
test_expect_failure \
6262
'(not) change HEAD with wrong SHA1' \
63-
'git-update-ref HEAD $B $Z'
63+
"git-update-ref HEAD $B $Z"
6464
test_expect_failure \
6565
"(not) changed .git/$m" \
66-
'test $B = $(cat .git/$m)'
66+
"test $B"' = $(cat .git/'"$m"')'
6767
rm -f .git/$m
6868

6969
mkdir -p .git/logs/refs/heads
7070
touch .git/logs/refs/heads/master
7171
test_expect_success \
7272
"create $m (logged by touch)" \
7373
'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"')'
7676
test_expect_success \
7777
"update $m (logged by touch)" \
7878
'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"')'
8181
test_expect_success \
8282
"set $m (logged by touch)" \
8383
'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"')'
8686

8787
cat >expect <<EOF
8888
$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
9191
EOF
9292
test_expect_success \
9393
"verifying $m's log" \
94-
'diff expect .git/logs/$m'
94+
"diff expect .git/logs/$m"
9595
rm -rf .git/$m .git/logs expect
9696

9797
test_expect_success \
@@ -102,18 +102,18 @@ test_expect_success \
102102
test_expect_success \
103103
"create $m (logged by config)" \
104104
'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"')'
107107
test_expect_success \
108108
"update $m (logged by config)" \
109109
'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"')'
112112
test_expect_success \
113113
"set $m (logged by config)" \
114114
'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"')'
117117

118118
cat >expect <<EOF
119119
$Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 +0000 Initial Creation
@@ -140,50 +140,50 @@ test_expect_success \
140140
'Query "master@{May 25 2005}" (before history)' \
141141
'rm -f o e
142142
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)"'
145145
test_expect_success \
146146
"Query master@{2005-05-25} (before history)" \
147147
'rm -f o e
148148
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)"'
151151
test_expect_success \
152152
'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \
153153
'rm -f o e
154154
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)"'
157157
test_expect_success \
158158
'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \
159159
'rm -f o e
160160
git-rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e &&
161-
test $A = $(cat o) &&
161+
test '"$A"' = $(cat o) &&
162162
test "" = "$(cat e)"'
163163
test_expect_success \
164164
'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \
165165
'rm -f o e
166166
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)"'
169169
test_expect_success \
170170
'Query "master@{2005-05-26 23:38:00}" (middle of history)' \
171171
'rm -f o e
172172
git-rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e &&
173-
test $Z = $(cat o) &&
173+
test '"$Z"' = $(cat o) &&
174174
test "" = "$(cat e)"'
175175
test_expect_success \
176176
'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \
177177
'rm -f o e
178178
git-rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e &&
179-
test $E = $(cat o) &&
179+
test '"$E"' = $(cat o) &&
180180
test "" = "$(cat e)"'
181181
test_expect_success \
182182
'Query "master@{2005-05-28}" (past end of history)' \
183183
'rm -f o e
184184
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)"'
187187

188188

189189
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
221221
EOF
222222
test_expect_success \
223223
'git-commit logged updates' \
224-
'diff expect .git/logs/$m'
224+
"diff expect .git/logs/$m"
225225
unset h_TEST h_OTHER h_FIXED h_MERGED
226226

227227
test_expect_success \

0 commit comments

Comments
 (0)