aboutsummaryrefslogtreecommitdiff
path: root/t/t4017-diff-retval.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-06-26 15:37:21 -0700
committerJunio C Hamano <gitster@pobox.com>2008-06-26 22:07:54 -0700
commit049540435fa5f7f583b8f5af257322b17eac7375 (patch)
tree501fceeeb949f29edeac20f6182635ca4323adaa /t/t4017-diff-retval.sh
parent877f23ccb88227203f2576abdfb5d1c15925fcb3 (diff)
downloadgit-049540435fa5f7f583b8f5af257322b17eac7375.tar.gz
git-049540435fa5f7f583b8f5af257322b17eac7375.tar.xz
diff --check: detect leftover conflict markers
This teaches "diff --check" to detect and complain if the change adds lines that look like leftover conflict markers. We should be able to remove the old Perl script used in the sample pre-commit hook and modernize the script with this facility. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4017-diff-retval.sh')
-rwxr-xr-xt/t4017-diff-retval.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh
index 0d0fb87f5..d748d45da 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 "$(grep "conflict marker" test.out | wc -l)" = 3 &&
+ git reset --hard
+'
+
test_done