From b717a627629e6886956af54274d507b9711d49e6 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 27 Mar 2008 03:30:43 -0400 Subject: add--interactive: ignore mode change in 'p'atch command When a path is examined in the patch subcommand, any mode changes in the file are given to use in the diff header by git-diff. If no hunks are staged, then we throw out that header and do not touch the path. But if _any_ hunks are staged, we use the header, and the mode is changed together with the contents. Since the 'p'atch command should just be dealing with hunks that are shown to the user, it makes sense to just ignore mode changes entirely. We do squirrel away the mode, though, since the next patch will allow users to select the mode update separately. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t3701-add-interactive.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't/t3701-add-interactive.sh') diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh index 77c90f6fa0..d920d06d5a 100755 --- a/t/t3701-add-interactive.sh +++ b/t/t3701-add-interactive.sh @@ -66,4 +66,13 @@ test_expect_success 'revert works (commit)' ' grep "unchanged *+3/-0 file" output ' +test_expect_success 'patch does not affect mode' ' + git reset --hard && + echo content >>file && + chmod +x file && + printf "y\\n" | git add -p && + git show :file | grep content && + git diff file | grep "new mode" +' + test_done -- cgit v1.2.3