summaryrefslogtreecommitdiffstats
path: root/diff.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2020-05-27 23:09:06 +0200
committerJunio C Hamano <gitster@pobox.com>2020-05-27 23:50:20 +0200
commit2c8bd8471a6abc68064dafc743362547fc730f77 (patch)
tree31442c60ddd564c9cffbfb33810ad79acaf0bfc1 /diff.c
parentci: include the built-in `git add -i` in the `linux-gcc` job (diff)
downloadgit-2c8bd8471a6abc68064dafc743362547fc730f77.tar.xz
git-2c8bd8471a6abc68064dafc743362547fc730f77.zip
checkout -p: handle new files correctly
The original patch selection code was written for `git add -p`, and the fundamental unit on which it works is a hunk. We hacked around that to handle deletions back in 24ab81ae4d (add-interactive: handle deletion of empty files, 2009-10-27). But `git add -p` would never see a new file, since we only consider the set of tracked files in the index. However, since the same machinery was used for `git checkout -p` & friends, we can see new files. Handle this case specifically, adding a new prompt for it that is modeled after the `deleted file` case. This also fixes the problem where added _empty_ files could not be staged via `git checkout -p`. Reported-by: Merlin Büge <toni@bluenox07.de> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions