@@ -28,18 +28,6 @@ create () {
28
28
git add " $1 "
29
29
}
30
30
31
- check_equal () {
32
- test_debug ' echo'
33
- test_debug " echo \" check a:\" \" {$1 }\" "
34
- test_debug " echo \" b:\" \" {$2 }\" "
35
- if test " $1 " = " $2 "
36
- then
37
- return 0
38
- else
39
- return 1
40
- fi
41
- }
42
-
43
31
undo () {
44
32
git reset --hard HEAD~
45
33
}
@@ -123,7 +111,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
123
111
cd "$test_count" &&
124
112
git fetch ./"sub proj" HEAD &&
125
113
git subtree add --prefix="sub dir" FETCH_HEAD &&
126
- check_equal "$(last_commit_message)" "Add ' \' ' sub dir/' \' ' from commit ' \' ' $(git rev-parse FETCH_HEAD)' \' ' "
114
+ test "$(last_commit_message)" = "Add ' \' ' sub dir/' \' ' from commit ' \' ' $(git rev-parse FETCH_HEAD)' \' ' "
127
115
)
128
116
'
129
117
@@ -136,7 +124,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix and --me
136
124
cd "$test_count" &&
137
125
git fetch ./"sub proj" HEAD &&
138
126
git subtree add --prefix="sub dir" --message="Added subproject" FETCH_HEAD &&
139
- check_equal "$(last_commit_message)" "Added subproject"
127
+ test "$(last_commit_message)" = "Added subproject"
140
128
)
141
129
'
142
130
@@ -149,7 +137,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix as -P an
149
137
cd "$test_count" &&
150
138
git fetch ./"sub proj" HEAD &&
151
139
git subtree add -P "sub dir" -m "Added subproject" FETCH_HEAD &&
152
- check_equal "$(last_commit_message)" "Added subproject"
140
+ test "$(last_commit_message)" = "Added subproject"
153
141
)
154
142
'
155
143
@@ -162,7 +150,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --squash and --pr
162
150
cd "$test_count" &&
163
151
git fetch ./"sub proj" HEAD &&
164
152
git subtree add --prefix="sub dir" --message="Added subproject with squash" --squash FETCH_HEAD &&
165
- check_equal "$(last_commit_message)" "Added subproject with squash"
153
+ test "$(last_commit_message)" = "Added subproject with squash"
166
154
)
167
155
'
168
156
@@ -185,7 +173,7 @@ test_expect_success 'merge new subproj history into sub dir/ with --prefix' '
185
173
cd "$test_count" &&
186
174
git fetch ./"sub proj" HEAD &&
187
175
git subtree merge --prefix="sub dir" FETCH_HEAD &&
188
- check_equal "$(last_commit_message)" "Merge commit ' \' ' $(git rev-parse FETCH_HEAD)' \' ' "
176
+ test "$(last_commit_message)" = "Merge commit ' \' ' $(git rev-parse FETCH_HEAD)' \' ' "
189
177
)
190
178
'
191
179
@@ -204,7 +192,7 @@ test_expect_success 'merge new subproj history into sub dir/ with --prefix and -
204
192
cd "$test_count" &&
205
193
git fetch ./"sub proj" HEAD &&
206
194
git subtree merge --prefix="sub dir" --message="Merged changes from subproject" FETCH_HEAD &&
207
- check_equal "$(last_commit_message)" "Merged changes from subproject"
195
+ test "$(last_commit_message)" = "Merged changes from subproject"
208
196
)
209
197
'
210
198
@@ -223,7 +211,7 @@ test_expect_success 'merge new subproj history into sub dir/ with --squash and -
223
211
cd "$test_count" &&
224
212
git fetch ./"sub proj" HEAD &&
225
213
git subtree merge --prefix="sub dir" --message="Merged changes from subproject using squash" --squash FETCH_HEAD &&
226
- check_equal "$(last_commit_message)" "Merged changes from subproject using squash"
214
+ test "$(last_commit_message)" = "Merged changes from subproject using squash"
227
215
)
228
216
'
229
217
@@ -239,7 +227,7 @@ test_expect_success 'merge the added subproj again, should do nothing' '
239
227
# this shouldn not actually do anything, since FETCH_HEAD
240
228
# is already a parent
241
229
result=$(git merge -s ours -m "merge -s -ours" FETCH_HEAD) &&
242
- check_equal "${result}" "Already up to date."
230
+ test "${result}" = "Already up to date."
243
231
)
244
232
'
245
233
@@ -258,7 +246,7 @@ test_expect_success 'merge new subproj history into subdir/ with a slash appende
258
246
cd "$test_count" &&
259
247
git fetch ./subproj HEAD &&
260
248
git subtree merge --prefix=subdir/ FETCH_HEAD &&
261
- check_equal "$(last_commit_message)" "Merge commit ' \' ' $(git rev-parse FETCH_HEAD)' \' ' "
249
+ test "$(last_commit_message)" = "Merge commit ' \' ' $(git rev-parse FETCH_HEAD)' \' ' "
262
250
)
263
251
'
264
252
@@ -324,7 +312,7 @@ test_expect_success 'split sub dir/ with --rejoin' '
324
312
git subtree merge --prefix="sub dir" FETCH_HEAD &&
325
313
split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
326
314
git subtree split --prefix="sub dir" --annotate="*" --rejoin &&
327
- check_equal "$(last_commit_message)" "Split ' \' ' sub dir/' \' ' into commit ' \' ' $split_hash' \' ' "
315
+ test "$(last_commit_message)" = "Split ' \' ' sub dir/' \' ' into commit ' \' ' $split_hash' \' ' "
328
316
)
329
317
'
330
318
@@ -339,7 +327,7 @@ test_expect_success 'split sub dir/ with --rejoin from scratch' '
339
327
git commit -m"sub dir file" &&
340
328
split_hash=$(git subtree split --prefix="sub dir" --rejoin) &&
341
329
git subtree split --prefix="sub dir" --rejoin &&
342
- check_equal "$(last_commit_message)" "Split ' \' ' sub dir/' \' ' into commit ' \' ' $split_hash' \' ' "
330
+ test "$(last_commit_message)" = "Split ' \' ' sub dir/' \' ' into commit ' \' ' $split_hash' \' ' "
343
331
)
344
332
'
345
333
@@ -362,7 +350,7 @@ test_expect_success 'split sub dir/ with --rejoin and --message' '
362
350
git fetch ./"sub proj" HEAD &&
363
351
git subtree merge --prefix="sub dir" FETCH_HEAD &&
364
352
git subtree split --prefix="sub dir" --message="Split & rejoin" --annotate="*" --rejoin &&
365
- check_equal "$(last_commit_message)" "Split & rejoin"
353
+ test "$(last_commit_message)" = "Split & rejoin"
366
354
)
367
355
'
368
356
@@ -386,7 +374,7 @@ test_expect_success 'split "sub dir"/ with --branch' '
386
374
git subtree merge --prefix="sub dir" FETCH_HEAD &&
387
375
split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
388
376
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br &&
389
- check_equal "$(git rev-parse subproj-br)" "$split_hash"
377
+ test "$(git rev-parse subproj-br)" = "$split_hash"
390
378
)
391
379
'
392
380
@@ -410,13 +398,13 @@ test_expect_success 'check hash of split' '
410
398
git subtree merge --prefix="sub dir" FETCH_HEAD &&
411
399
split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
412
400
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br &&
413
- check_equal "$(git rev-parse subproj-br)" "$split_hash" &&
401
+ test "$(git rev-parse subproj-br)" = "$split_hash" &&
414
402
# Check hash of split
415
403
new_hash=$(git rev-parse subproj-br^2) &&
416
404
(
417
405
cd ./"sub proj" &&
418
406
subdir_hash=$(git rev-parse HEAD) &&
419
- check_equal ' ' "$new_hash"' ' "$subdir_hash"
407
+ test ' ' "$new_hash"' ' = "$subdir_hash"
420
408
)
421
409
)
422
410
'
@@ -442,7 +430,7 @@ test_expect_success 'split "sub dir"/ with --branch for an existing branch' '
442
430
git subtree merge --prefix="sub dir" FETCH_HEAD &&
443
431
split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
444
432
git subtree split --prefix="sub dir" --annotate="*" --branch subproj-br &&
445
- check_equal "$(git rev-parse subproj-br)" "$split_hash"
433
+ test "$(git rev-parse subproj-br)" = "$split_hash"
446
434
)
447
435
'
448
436
@@ -740,7 +728,7 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'
740
728
(
741
729
cd "$test_count" &&
742
730
git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
743
- check_equal "$(git log --pretty=format:"%s" HEAD^2 | grep -i split)" ""
731
+ test "$(git log --pretty=format:"%s" HEAD^2 | grep -i split)" = ""
744
732
)
745
733
'
746
734
@@ -791,7 +779,7 @@ test_expect_success 'make sure no "git subtree" tagged commits make it into subp
791
779
git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
792
780
793
781
# They are meaningless to subproj since one side of the merge refers to the mainline
794
- check_equal "$(git log --pretty=format:"%s%n%b" HEAD^2 | grep "git-subtree.*:")" ""
782
+ test "$(git log --pretty=format:"%s%n%b" HEAD^2 | grep "git-subtree.*:")" = ""
795
783
)
796
784
'
797
785
@@ -825,7 +813,7 @@ test_expect_success 'make sure "git subtree split" find the correct parent' '
825
813
# not, something went wrong (the "newparent" of "HEAD~" commit should
826
814
# have been sub2, but it was not, because its cache was not set to
827
815
# itself)
828
- check_equal "$(git log --pretty=format:%P -1 subproj-br)" "$(git rev-parse subproj-ref)"
816
+ test "$(git log --pretty=format:%P -1 subproj-br)" = "$(git rev-parse subproj-ref)"
829
817
)
830
818
'
831
819
@@ -859,7 +847,7 @@ test_expect_success 'split a new subtree without --onto option' '
859
847
# if the parent of the first commit in the tree is not empty,
860
848
# then the new subtree has accidentally been attached to something
861
849
git subtree split --prefix="sub dir2" --branch subproj2-br &&
862
- check_equal "$(git log --pretty=format:%P -1 subproj2-br)" ""
850
+ test "$(git log --pretty=format:%P -1 subproj2-br)" = ""
863
851
)
864
852
'
865
853
@@ -899,10 +887,10 @@ test_expect_success 'verify one file change per commit' '
899
887
test_debug "echo Verifying commit $commit"
900
888
test_debug "echo a: $a"
901
889
test_debug "echo b: $b"
902
- check_equal "$b" ""
890
+ test "$b" = ""
903
891
x=1
904
892
done
905
- check_equal "$x" 1
893
+ test "$x" = 1
906
894
)
907
895
)
908
896
'
@@ -934,7 +922,7 @@ test_expect_success 'push split to subproj' '
934
922
git subtree push ./"sub proj" --prefix "sub dir" sub-branch-1 &&
935
923
cd ./"sub proj" &&
936
924
git checkout sub-branch-1 &&
937
- check_equal "$(last_commit_message)" "sub dir/main-sub3"
925
+ test "$(last_commit_message)" = "sub dir/main-sub3"
938
926
)
939
927
'
940
928
@@ -994,7 +982,7 @@ test_expect_success 'subtree descendant check' '
994
982
995
983
git subtree split --prefix folder_subtree/ --branch subtree_tip $defaultBranch &&
996
984
git subtree split --prefix folder_subtree/ --branch subtree_branch branch &&
997
- check_equal $(git rev-list --count subtree_tip..subtree_branch) 0
985
+ test $(git rev-list --count subtree_tip..subtree_branch) = 0
998
986
)
999
987
'
1000
988
0 commit comments