From 088304bf73b9b4149e04d2246fe08a06eef6e795 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 23 Jan 2014 14:54:57 -0500 Subject: t7501: fix "empty commit" test with NO_PERL t7501.9 tries to check that "git commit" will fail when the index is unchanged. It relies on previous tests not to have modified the index. When it was originally written, this was always the case. However, commit c65dc35 (t7501: test the right kind of breakage, 2012-03-30) changed earlier tests (4 and 5) to leave a modification in the index. We never noticed, however, because t7501.7, between the two, clears the index state as a side effect. However, that test depends on the PERL prerequisite, and so it does not always run. Therefore if NO_PERL is set, we do not run the intervening test, the index is left unclean, and t7501.9 fails. We could fix this by moving t7501.9 up in the script. However, this patch instead leaves it in place and adds a "git reset" before the commit. This makes the test more explicit about its preconditions, and will future-proof it against any other changes in the test state. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index f04798f872..94eec83b37 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -57,6 +57,7 @@ test_expect_success 'using invalid commit with -C' ' ' test_expect_success 'nothing to commit' ' + git reset --hard && test_must_fail git commit -m initial ' -- cgit v1.2.3 From a0332337be53f266682279c72a5e553986638c87 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 23 Jan 2014 14:55:18 -0500 Subject: t7700: do not use "touch" unnecessarily Some versions of touch (such as /usr/ucb/touch on Solaris) do not know about the "-r" option. This would make sense as a feature of test-chmtime, but fortunately this fix is even easier. The test does not care about the timestamp of the .keep file it creates at all, only that it exists. For such a use case, with or without portability issues around "-r", "touch" should not be used in the first place. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t7700-repack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index d954b846a1..b45bd1e76c 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -17,7 +17,7 @@ test_expect_success 'objects in packs marked .keep are not repacked' ' # The second pack will contain the excluded object packsha1=$(git rev-list --objects --all | grep file2 | git pack-objects pack) && - touch -r pack-$packsha1.pack pack-$packsha1.keep && + >pack-$packsha1.keep && objsha1=$(git verify-pack -v pack-$packsha1.idx | head -n 1 | sed -e "s/^\([0-9a-f]\{40\}\).*/\1/") && mv pack-* .git/objects/pack/ && -- cgit v1.2.3