aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-07-01 16:22:35 -0700
committerJunio C Hamano <gitster@pobox.com>2008-07-01 16:22:35 -0700
commitd4b76e15ea733002e364298a81889452b8bb2dfd (patch)
tree5a8456715cf28f96e247cd2f3f61cf5922910b09 /t
parentf7c3cf8106c09c714d46d39e8eef69838db8b339 (diff)
parentab20fda99236e38edf5d63f964b6b920b494aacb (diff)
downloadgit-d4b76e15ea733002e364298a81889452b8bb2dfd.tar.gz
git-d4b76e15ea733002e364298a81889452b8bb2dfd.tar.xz
Merge branch 'jc/checkdiff'
* jc/checkdiff: Fix t4017-diff-retval for white-space from wc Update sample pre-commit hook to use "diff --check" diff --check: detect leftover conflict markers Teach "diff --check" about new blank lines at end checkdiff: pass diff_options to the callback check_and_emit_line(): rename and refactor diff --check: explain why we do not care whether old side is binary
Diffstat (limited to 't')
-rwxr-xr-xt/t4015-diff-whitespace.sh6
-rwxr-xr-xt/t4017-diff-retval.sh14
2 files changed, 20 insertions, 0 deletions
diff --git a/t/t4015-diff-whitespace.sh b/t/t4015-diff-whitespace.sh
index b7cc6b28e..0922c708f 100755
--- a/t/t4015-diff-whitespace.sh
+++ b/t/t4015-diff-whitespace.sh
@@ -335,4 +335,10 @@ test_expect_success 'line numbers in --check output are correct' '
'
+test_expect_success 'checkdiff detects trailing blank lines' '
+ echo "foo();" >x &&
+ echo "" >>x &&
+ git diff --check | grep "ends with blank"
+'
+
test_done
diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh
index 0d0fb87f5..60dd2014d 100755
--- a/t/t4017-diff-retval.sh
+++ b/t/t4017-diff-retval.sh
@@ -113,4 +113,18 @@ test_expect_success 'check should test not just the last line' '
'
+test_expect_success 'check detects leftover conflict markers' '
+ git reset --hard &&
+ git checkout HEAD^ &&
+ echo binary >>b &&
+ git commit -m "side" b &&
+ test_must_fail git merge master &&
+ git add b && (
+ git --no-pager diff --cached --check >test.out
+ test $? = 2
+ ) &&
+ test 3 = $(grep "conflict marker" test.out | wc -l) &&
+ git reset --hard
+'
+
test_done