summaryrefslogtreecommitdiff
path: root/t/t4027-diff-submodule.sh
diff options
context:
space:
mode:
authorBrian Gernhardt <brian@silverinsanity.com>2010-06-25 17:20:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-06-25 17:54:04 (GMT)
commit6ed7ddaadba9217b794aecf6d74a2e455daf7a96 (patch)
treea737d30a55681c332073eaef856c8c34949c3566 /t/t4027-diff-submodule.sh
parentdd44d419d30afa52b863efa07aeec738c4531ea9 (diff)
downloadgit-6ed7ddaadba9217b794aecf6d74a2e455daf7a96.zip
git-6ed7ddaadba9217b794aecf6d74a2e455daf7a96.tar.gz
git-6ed7ddaadba9217b794aecf6d74a2e455daf7a96.tar.bz2
t4027,4041: Use test -s to test for an empty file
The tests used a mixture of 'echo -n' (which is non-portable) and either test_cmp or diff to check if a file is empty. The much easier and portable method to check for an empty file is '! test -s' While we're in t4027, there was an excess test_done. Remove it. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4027-diff-submodule.sh')
-rwxr-xr-xt/t4027-diff-submodule.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh
index 559b41e..1bd8e5e 100755
--- a/t/t4027-diff-submodule.sh
+++ b/t/t4027-diff-submodule.sh
@@ -105,15 +105,15 @@ test_expect_success 'git diff HEAD with dirty submodule (work tree, refs match)'
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual.body &&
git diff --ignore-submodules HEAD >actual2 &&
- echo -n "" | test_cmp - actual2 &&
+ ! test -s actual2 &&
git diff --ignore-submodules=untracked HEAD >actual3 &&
sed -e "1,/^@@/d" actual3 >actual3.body &&
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual3.body &&
git diff --ignore-submodules=dirty HEAD >actual4 &&
- echo -n "" | test_cmp - actual4
+ ! test -s actual4
'
-test_done
+
test_expect_success 'git diff HEAD with dirty submodule (index, refs match)' '
(
cd sub &&
@@ -139,11 +139,11 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
expect_from_to >expect.body $subprev $subprev-dirty &&
test_cmp expect.body actual.body &&
git diff --ignore-submodules=all HEAD >actual2 &&
- echo -n "" | test_cmp - actual2 &&
+ ! test -s actual2 &&
git diff --ignore-submodules=untracked HEAD >actual3 &&
- echo -n "" | test_cmp - actual3 &&
+ ! test -s actual3 &&
git diff --ignore-submodules=dirty HEAD >actual4 &&
- echo -n "" | test_cmp - actual4
+ ! test -s actual4
'
test_expect_success 'git diff (empty submodule dir)' '