summaryrefslogtreecommitdiff
path: root/t/t3701-add-interactive.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-09-09 19:02:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-09-09 19:02:24 (GMT)
commitfb094cb583e9e0f3842a6c445ccf84455cf17136 (patch)
tree449854298d55d9626386debe2404fd0e1063b22c /t/t3701-add-interactive.sh
parent79f2338b3746d23454308648b2491e5beba4beff (diff)
parent0a101676e58481f134353ee1ff3ccee6cbbbb74b (diff)
downloadgit-fb094cb583e9e0f3842a6c445ccf84455cf17136.zip
git-fb094cb583e9e0f3842a6c445ccf84455cf17136.tar.gz
git-fb094cb583e9e0f3842a6c445ccf84455cf17136.tar.bz2
Merge branch 'js/add-p-diff-parsing-fix'
Those who use diff-so-fancy as the diff-filter noticed a regression or two in the code that parses the diff output in the built-in version of "add -p", which has been corrected. * js/add-p-diff-parsing-fix: add -p: ignore dirty submodules add -p: gracefully handle unparseable hunk headers in colored diffs add -p: detect more mismatches between plain vs colored diffs
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-xt/t3701-add-interactive.sh27
1 files changed, 25 insertions, 2 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 3b7df9b..5a7a0ea 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -761,9 +761,20 @@ test_expect_success 'detect bogus diffFilter output' '
git reset --hard &&
echo content >test &&
- test_config interactive.diffFilter "sed 1d" &&
+ test_config interactive.diffFilter "sed 6d" &&
printf y >y &&
- force_color test_must_fail git add -p <y
+ force_color test_must_fail git add -p <y >output 2>&1 &&
+ grep "mismatched output" output
+'
+
+test_expect_success 'handle iffy colored hunk headers' '
+ git reset --hard &&
+
+ echo content >test &&
+ printf n >n &&
+ force_color git -c interactive.diffFilter="sed s/.*@@.*/XX/" \
+ add -p >output 2>&1 <n &&
+ grep "^XX$" output
'
test_expect_success 'handle very large filtered diff' '
@@ -944,6 +955,18 @@ test_expect_success 'status ignores dirty submodules (except HEAD)' '
! grep dirty-otherwise output
'
+test_expect_success 'handle submodules' '
+ echo 123 >>for-submodules/dirty-otherwise/initial.t &&
+
+ force_color git -C for-submodules add -p dirty-otherwise >output 2>&1 &&
+ grep "No changes" output &&
+
+ force_color git -C for-submodules add -p dirty-head >output 2>&1 <y &&
+ git -C for-submodules ls-files --stage dirty-head >actual &&
+ rev="$(git -C for-submodules/dirty-head rev-parse HEAD)" &&
+ grep "$rev" actual
+'
+
test_expect_success 'set up pathological context' '
git reset --hard &&
test_write_lines a a a a a a a a a a a >a &&