summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNazri Ramliy <ayiehere@gmail.com>2013-09-19 21:18:54 +0800
committerJunio C Hamano <gitster@pobox.com>2013-09-19 10:15:06 -0700
commit28a81f8b93897402a8c8c15ee16e67f0c24ac11c (patch)
treea1ff5f12774e784e399f45042349c55a802ea976
parent44e1e4d67d5148c245db362cc48c3cc6c2ec82ca (diff)
downloadgit-nr/git-cd-to-a-directory.tar.gz
t0056: "git -C" test updatesnr/git-cd-to-a-directory
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 <ayiehere@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t0056-git-C.sh14
1 files changed, 8 insertions, 6 deletions
diff --git a/t/t0056-git-C.sh b/t/t0056-git-C.sh
index c0006da072..99c037703a 100755
--- a/t/t0056-git-C.sh
+++ b/t/t0056-git-C.sh
@@ -7,18 +7,20 @@ test_description='"-C <path>" option and its effects on other path-related optio
test_expect_success '"git -C <path>" runs git from the directory <path>' '
test_create_repo dir1 &&
echo 1 >dir1/a.txt &&
- (cd dir1 && git add a.txt && git commit -m "initial in dir1") &&
- echo "initial in dir1" >expected &&
+ msg="initial in dir1" &&
+ (cd dir1 && git add a.txt && git commit -m "$msg") &&
+ echo "$msg" >expected &&
git -C dir1 log --format=%s >actual &&
test_cmp expected actual
'
test_expect_success 'Multiple -C options: "-C dir1 -C dir2" is equivalent to "-C dir1/dir2"' '
test_create_repo dir1/dir2 &&
- echo 1 >dir1/dir2/a.txt &&
- git -C dir1/dir2 add a.txt &&
- echo "initial in dir1/dir2" >expected &&
- git -C dir1/dir2 commit -m "initial in dir1/dir2" &&
+ echo 1 >dir1/dir2/b.txt &&
+ git -C dir1/dir2 add b.txt &&
+ msg="initial in dir1/dir2" &&
+ echo "$msg" >expected &&
+ git -C dir1/dir2 commit -m "$msg" &&
git -C dir1 -C dir2 log --format=%s >actual &&
test_cmp expected actual
'