aboutsummaryrefslogtreecommitdiff
path: root/t/t7102-reset.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-05-23 22:28:56 -0700
committerJunio C Hamano <gitster@pobox.com>2008-05-24 00:01:56 -0700
commit3af828634fa5bdbca1b2061a81df8b3fa73b0d34 (patch)
treef4d4a50e8c1686b3ecd796a09f98cc6ca13bc907 /t/t7102-reset.sh
parent998b912927281a871e8d379e2b3a4385c775c4fe (diff)
downloadgit-3af828634fa5bdbca1b2061a81df8b3fa73b0d34.tar.gz
git-3af828634fa5bdbca1b2061a81df8b3fa73b0d34.tar.xz
tests: do not use implicit "git diff --no-index"
As a general principle, we should not use "git diff" to validate the results of what git command that is being tested has done. We would not know if we are testing the command in question, or locating a bug in the cute hack of "git diff --no-index". Rather use test_cmp for that purpose. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7102-reset.sh')
-rwxr-xr-xt/t7102-reset.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index e5c9f30c7..39ba14148 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -34,13 +34,13 @@ test_expect_success 'creating initial files and commits' '
check_changes () {
test "$(git rev-parse HEAD)" = "$1" &&
- git diff | git diff .diff_expect - &&
- git diff --cached | git diff .cached_expect - &&
+ git diff | test_cmp .diff_expect - &&
+ git diff --cached | test_cmp .cached_expect - &&
for FILE in *
do
echo $FILE':'
cat $FILE || return
- done | git diff .cat_expect -
+ done | test_cmp .cat_expect -
}
>.diff_expect
@@ -390,9 +390,9 @@ test_expect_success 'test --mixed <paths>' '
git add file1 file3 file4 &&
! git reset HEAD -- file1 file2 file3 &&
git diff > output &&
- git diff output expect &&
+ test_cmp output expect &&
git diff --cached > output &&
- git diff output cached_expect
+ test_cmp output cached_expect
'
test_expect_success 'test resetting the index at give paths' '
@@ -425,7 +425,7 @@ EOF
test_expect_success '--mixed refreshes the index' '
echo 123 >> file2 &&
git reset --mixed HEAD > output &&
- git diff --exit-code expect output
+ test_cmp expect output
'
test_done