@@ -14,7 +14,13 @@ test_expect_success setup '
rm -f test-file &&
git diff >deletion-patch &&
- grep "deleted file mode 100644" deletion-patch
+ grep "deleted file mode 100644" deletion-patch &&
+
+ git rm -f test-file &&
+ touch test-file &&
+ git add test-file &&
+ cat blueprint >test-file &&
+ git diff >incorrect-patch
'
test_expect_success 'apply creation patch to ita path (--cached)' '
@@ -27,6 +33,14 @@ test_expect_success 'apply creation patch to ita path (--cached)' '
test_cmp blueprint actual
'
+test_expect_success 'apply diff from empty blob to ita path (--cached)' '
+ git rm -f test-file &&
+ cat blueprint >test-file &&
+ git add -N test-file &&
+
+ test_must_fail git apply --cached incorrect-patch
+'
+
test_expect_success 'apply creation patch to ita path (--index)' '
git rm -f test-file &&
cat blueprint >test-file &&
"git apply" should only accept new file or deleted file patches to an i-t-a index entry. Signed-off-by: Raymond E. Pasco <ray@ameretat.dev> --- t/t4140-apply-ita.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)