From cff5dc09ed0d07461bf77e9abef57dc86a11ab77 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Sat, 26 May 2018 14:08:46 +0200 Subject: apply: add --intent-to-add MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- t/t2203-add-intent.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't') 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 -- cgit v1.3