summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-05-26 14:08:46 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-05-29 12:42:30 +0900
commitcff5dc09ed0d07461bf77e9abef57dc86a11ab77 (patch)
treef72684761303670cba7ad8a2d6178254ed5ef3e9 /t
parentt2203: add a test about "diff HEAD" case (diff)
downloadtgif-cff5dc09ed0d07461bf77e9abef57dc86a11ab77.tar.xz
apply: add --intent-to-add
Similar to 'git reset -N', this option makes 'git apply' automatically mark new files as intent-to-add so they are visible in the following 'git diff' command and could also be committed with 'git commit -a'. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t2203-add-intent.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t2203-add-intent.sh b/t/t2203-add-intent.sh
index 546fead6ad..0891827863 100755
--- a/t/t2203-add-intent.sh
+++ b/t/t2203-add-intent.sh
@@ -245,6 +245,7 @@ test_expect_success 'diff-files/diff-cached shows ita as new/not-new files' '
test_cmp expected2 actual2
'
+
test_expect_success '"diff HEAD" includes ita as new files' '
git reset --hard &&
echo new >new-ita &&
@@ -262,4 +263,16 @@ test_expect_success '"diff HEAD" includes ita as new files' '
test_cmp expected actual
'
+test_expect_success 'apply --intent-to-add' '
+ git reset --hard &&
+ echo new >new-ita &&
+ git add -N new-ita &&
+ git diff >expected &&
+ grep "new file" expected &&
+ git reset --hard &&
+ git apply --intent-to-add expected &&
+ git diff >actual &&
+ test_cmp expected actual
+'
+
test_done