@@ -28,18 +28,6 @@ create () {
2828 git add " $1 "
2929}
3030
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-
4331undo () {
4432 git reset --hard HEAD~
4533}
@@ -123,7 +111,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix' '
123111 cd "$test_count" &&
124112 git fetch ./"sub proj" HEAD &&
125113 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)' \' ' "
127115 )
128116'
129117
@@ -136,7 +124,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix and --me
136124 cd "$test_count" &&
137125 git fetch ./"sub proj" HEAD &&
138126 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"
140128 )
141129'
142130
@@ -149,7 +137,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --prefix as -P an
149137 cd "$test_count" &&
150138 git fetch ./"sub proj" HEAD &&
151139 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"
153141 )
154142'
155143
@@ -162,7 +150,7 @@ test_expect_success 'add subproj as subtree into sub dir/ with --squash and --pr
162150 cd "$test_count" &&
163151 git fetch ./"sub proj" HEAD &&
164152 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"
166154 )
167155'
168156
@@ -185,7 +173,7 @@ test_expect_success 'merge new subproj history into sub dir/ with --prefix' '
185173 cd "$test_count" &&
186174 git fetch ./"sub proj" HEAD &&
187175 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)' \' ' "
189177 )
190178'
191179
@@ -204,7 +192,7 @@ test_expect_success 'merge new subproj history into sub dir/ with --prefix and -
204192 cd "$test_count" &&
205193 git fetch ./"sub proj" HEAD &&
206194 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"
208196 )
209197'
210198
@@ -223,7 +211,7 @@ test_expect_success 'merge new subproj history into sub dir/ with --squash and -
223211 cd "$test_count" &&
224212 git fetch ./"sub proj" HEAD &&
225213 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"
227215 )
228216'
229217
@@ -239,7 +227,7 @@ test_expect_success 'merge the added subproj again, should do nothing' '
239227 # this shouldn not actually do anything, since FETCH_HEAD
240228 # is already a parent
241229 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."
243231 )
244232'
245233
@@ -258,7 +246,7 @@ test_expect_success 'merge new subproj history into subdir/ with a slash appende
258246 cd "$test_count" &&
259247 git fetch ./subproj HEAD &&
260248 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)' \' ' "
262250 )
263251'
264252
@@ -324,7 +312,7 @@ test_expect_success 'split sub dir/ with --rejoin' '
324312 git subtree merge --prefix="sub dir" FETCH_HEAD &&
325313 split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
326314 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' \' ' "
328316 )
329317'
330318
@@ -339,7 +327,7 @@ test_expect_success 'split sub dir/ with --rejoin from scratch' '
339327 git commit -m"sub dir file" &&
340328 split_hash=$(git subtree split --prefix="sub dir" --rejoin) &&
341329 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' \' ' "
343331 )
344332'
345333
@@ -362,7 +350,7 @@ test_expect_success 'split sub dir/ with --rejoin and --message' '
362350 git fetch ./"sub proj" HEAD &&
363351 git subtree merge --prefix="sub dir" FETCH_HEAD &&
364352 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"
366354 )
367355'
368356
@@ -386,7 +374,7 @@ test_expect_success 'split "sub dir"/ with --branch' '
386374 git subtree merge --prefix="sub dir" FETCH_HEAD &&
387375 split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
388376 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"
390378 )
391379'
392380
@@ -410,13 +398,13 @@ test_expect_success 'check hash of split' '
410398 git subtree merge --prefix="sub dir" FETCH_HEAD &&
411399 split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
412400 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" &&
414402 # Check hash of split
415403 new_hash=$(git rev-parse subproj-br^2) &&
416404 (
417405 cd ./"sub proj" &&
418406 subdir_hash=$(git rev-parse HEAD) &&
419- check_equal ' ' "$new_hash"' ' "$subdir_hash"
407+ test ' ' "$new_hash"' ' = "$subdir_hash"
420408 )
421409 )
422410'
@@ -442,7 +430,7 @@ test_expect_success 'split "sub dir"/ with --branch for an existing branch' '
442430 git subtree merge --prefix="sub dir" FETCH_HEAD &&
443431 split_hash=$(git subtree split --prefix="sub dir" --annotate="*") &&
444432 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"
446434 )
447435'
448436
@@ -740,7 +728,7 @@ test_expect_success 'make sure the --rejoin commits never make it into subproj'
740728 (
741729 cd "$test_count" &&
742730 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)" = ""
744732 )
745733'
746734
@@ -791,7 +779,7 @@ test_expect_success 'make sure no "git subtree" tagged commits make it into subp
791779 git subtree pull --prefix="sub dir" ./"sub proj" HEAD &&
792780
793781 # 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.*:")" = ""
795783 )
796784'
797785
@@ -825,7 +813,7 @@ test_expect_success 'make sure "git subtree split" find the correct parent' '
825813 # not, something went wrong (the "newparent" of "HEAD~" commit should
826814 # have been sub2, but it was not, because its cache was not set to
827815 # 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)"
829817 )
830818'
831819
@@ -859,7 +847,7 @@ test_expect_success 'split a new subtree without --onto option' '
859847 # if the parent of the first commit in the tree is not empty,
860848 # then the new subtree has accidentally been attached to something
861849 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)" = ""
863851 )
864852'
865853
@@ -899,10 +887,10 @@ test_expect_success 'verify one file change per commit' '
899887 test_debug "echo Verifying commit $commit"
900888 test_debug "echo a: $a"
901889 test_debug "echo b: $b"
902- check_equal "$b" ""
890+ test "$b" = ""
903891 x=1
904892 done
905- check_equal "$x" 1
893+ test "$x" = 1
906894 )
907895 )
908896'
@@ -934,7 +922,7 @@ test_expect_success 'push split to subproj' '
934922 git subtree push ./"sub proj" --prefix "sub dir" sub-branch-1 &&
935923 cd ./"sub proj" &&
936924 git checkout sub-branch-1 &&
937- check_equal "$(last_commit_message)" "sub dir/main-sub3"
925+ test "$(last_commit_message)" = "sub dir/main-sub3"
938926 )
939927'
940928
@@ -994,7 +982,7 @@ test_expect_success 'subtree descendant check' '
994982
995983 git subtree split --prefix folder_subtree/ --branch subtree_tip $defaultBranch &&
996984 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
998986 )
999987'
1000988
0 commit comments