summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-07-22 18:23:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-07-22 18:23:27 (GMT)
commite2ecd252b5e3c90c211075ba9d1017379782708b (patch)
tree1f8a76636533b3f22006fef018e3dc30fbbc3bf8 /t
parent8827a58cf0ac7bee4ac8d357236975ead9783df3 (diff)
parent4ba258b7e1020e8e3f321ca2df01e34cd71bee88 (diff)
downloadgit-e2ecd252b5e3c90c211075ba9d1017379782708b.zip
git-e2ecd252b5e3c90c211075ba9d1017379782708b.tar.gz
git-e2ecd252b5e3c90c211075ba9d1017379782708b.tar.bz2
Merge branch 'mm/diff-no-patch-synonym-to-s'
"git show -s" was less discoverable than it should be. * mm/diff-no-patch-synonym-to-s: Documentation/git-log.txt: capitalize section names Documentation: move description of -s, --no-patch to diff-options.txt Documentation/git-show.txt: include common diff options, like git-log.txt diff: allow --patch & cie to override -s/--no-patch diff: allow --no-patch as synonym for -s t4000-diff-format.sh: modernize style
Diffstat (limited to 't')
-rwxr-xr-xt/t4000-diff-format.sh48
1 files changed, 39 insertions, 9 deletions
diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh
index 6ddd469..8de36b7 100755
--- a/t/t4000-diff-format.sh
+++ b/t/t4000-diff-format.sh
@@ -15,17 +15,17 @@ line 3'
cat path0 >path1
chmod +x path1
-test_expect_success \
- 'update-index --add two files with and without +x.' \
- 'git update-index --add path0 path1'
+test_expect_success 'update-index --add two files with and without +x.' '
+ git update-index --add path0 path1
+'
mv path0 path0-
sed -e 's/line/Line/' <path0- >path0
chmod +x path0
rm -f path1
-test_expect_success \
- 'git diff-files -p after editing work tree.' \
- 'git diff-files -p >current'
+test_expect_success 'git diff-files -p after editing work tree.' '
+ git diff-files -p >actual
+'
# that's as far as it comes
if [ "$(git config --get core.filemode)" = false ]
@@ -55,8 +55,38 @@ deleted file mode 100755
-line 3
EOF
-test_expect_success \
- 'validate git diff-files -p output.' \
- 'compare_diff_patch current expected'
+test_expect_success 'validate git diff-files -p output.' '
+ compare_diff_patch expected actual
+'
+
+test_expect_success 'git diff-files -s after editing work tree' '
+ git diff-files -s >actual 2>err &&
+ test_must_be_empty actual &&
+ test_must_be_empty err
+'
+
+test_expect_success 'git diff-files --no-patch as synonym for -s' '
+ git diff-files --no-patch >actual 2>err &&
+ test_must_be_empty actual &&
+ test_must_be_empty err
+'
+
+test_expect_success 'git diff-files --no-patch --patch shows the patch' '
+ git diff-files --no-patch --patch >actual &&
+ compare_diff_patch expected actual
+'
+
+test_expect_success 'git diff-files --no-patch --patch-with-raw shows the patch and raw data' '
+ git diff-files --no-patch --patch-with-raw >actual &&
+ grep -q "^:100644 100755 .* 0000000000000000000000000000000000000000 M path0\$" actual &&
+ tail -n +4 actual >actual-patch &&
+ compare_diff_patch expected actual-patch
+'
+
+test_expect_success 'git diff-files --patch --no-patch does not show the patch' '
+ git diff-files --patch --no-patch >actual 2>err &&
+ test_must_be_empty actual &&
+ test_must_be_empty err
+'
test_done