docs/diff-options: clarify scope of diff-filter types
[gitweb.git] / t / t3701-add-interactive.sh
index deae948c76bd12f9b3ef6b54568717b21d641d8a..aaa258daa376ab6d18d71a04a517840e1b55d094 100755 (executable)
@@ -380,4 +380,36 @@ test_expect_success 'patch mode ignores unmerged entries' '
        test_cmp expected diff
 '
 
+test_expect_success 'diffs can be colorized' '
+       git reset --hard &&
+
+       # force color even though the test script has no terminal
+       test_config color.ui always &&
+
+       echo content >test &&
+       printf y | git add -p >output 2>&1 &&
+
+       # We do not want to depend on the exact coloring scheme
+       # git uses for diffs, so just check that we saw some kind of color.
+       grep "$(printf "\\033")" output
+'
+
+test_expect_success 'patch-mode via -i prompts for files' '
+       git reset --hard &&
+
+       echo one >file &&
+       echo two >test &&
+       git add -i <<-\EOF &&
+       patch
+       test
+
+       y
+       quit
+       EOF
+
+       echo test >expect &&
+       git diff --cached --name-only >actual &&
+       test_cmp expect actual
+'
+
 test_done