Code

Merge branch 'jc/checkout-detached' into maint
[git.git] / t / t4017-diff-retval.sh
index 0d0fb87f5732e3ecbca8a195843070539353701e..0391a5827ea8ba196b7796b7df818f8ac860c387 100755 (executable)
@@ -5,6 +5,9 @@ test_description='Return value of diffs'
 . ./test-lib.sh
 
 test_expect_success 'setup' '
+       echo "1 " >a &&
+       git add . &&
+       git commit -m zeroth &&
        echo 1 >a &&
        git add . &&
        git commit -m first &&
@@ -13,6 +16,18 @@ test_expect_success 'setup' '
        git commit -a -m second
 '
 
+test_expect_success 'git diff --quiet -w  HEAD^^ HEAD^' '
+       git diff --quiet -w HEAD^^ HEAD^
+'
+
+test_expect_success 'git diff --quiet HEAD^^ HEAD^' '
+       test_must_fail git diff --quiet HEAD^^ HEAD^
+'
+
+test_expect_success 'git diff --quiet -w  HEAD^ HEAD' '
+       test_must_fail git diff --quiet -w HEAD^ HEAD
+'
+
 test_expect_success 'git diff-tree HEAD^ HEAD' '
        git diff-tree --exit-code HEAD^ HEAD
        test $? = 1
@@ -113,4 +128,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