Skip to content

Commit 28a81f8

Browse files
nazrigitster
authored andcommitted
t0056: "git -C" test updates
Instead of repeating the text to record as the commit log message and string we expect to see in "log" output, use the same variable to avoid them going out of sync. Use different names for test files in different directories to improve our chance to catch future breakages that makes "-C <dir>" go to a place that is different from what was specified. Signed-off-by: Nazri Ramliy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 44e1e4d commit 28a81f8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

t/t0056-git-C.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,20 @@ test_description='"-C <path>" option and its effects on other path-related optio
77
test_expect_success '"git -C <path>" runs git from the directory <path>' '
88
test_create_repo dir1 &&
99
echo 1 >dir1/a.txt &&
10-
(cd dir1 && git add a.txt && git commit -m "initial in dir1") &&
11-
echo "initial in dir1" >expected &&
10+
msg="initial in dir1" &&
11+
(cd dir1 && git add a.txt && git commit -m "$msg") &&
12+
echo "$msg" >expected &&
1213
git -C dir1 log --format=%s >actual &&
1314
test_cmp expected actual
1415
'
1516

1617
test_expect_success 'Multiple -C options: "-C dir1 -C dir2" is equivalent to "-C dir1/dir2"' '
1718
test_create_repo dir1/dir2 &&
18-
echo 1 >dir1/dir2/a.txt &&
19-
git -C dir1/dir2 add a.txt &&
20-
echo "initial in dir1/dir2" >expected &&
21-
git -C dir1/dir2 commit -m "initial in dir1/dir2" &&
19+
echo 1 >dir1/dir2/b.txt &&
20+
git -C dir1/dir2 add b.txt &&
21+
msg="initial in dir1/dir2" &&
22+
echo "$msg" >expected &&
23+
git -C dir1/dir2 commit -m "$msg" &&
2224
git -C dir1 -C dir2 log --format=%s >actual &&
2325
test_cmp expected actual
2426
'

0 commit comments

Comments
 (0)