author | Jeff King <peff@peff.net> | |
Wed, 28 Oct 2009 00:52:57 +0000 (20:52 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 28 Oct 2009 06:19:04 +0000 (23:19 -0700) | ||
commit | 24ab81ae4d12c81076da256b3f9cdde45277f126 | |
tree | 840109afbe8820d385bfa23bc79c6cde766a7ad4 | tree | snapshot |
parent | 78d553b7d7b269bb22ebd8b1198657c37484a3a0 | commit | diff |
add-interactive: handle deletion of empty files
Usually we show deletion as a big hunk deleting all of the
file's text. However, for files with no content, the diff
shows just the 'deleted file mode ...' line. This patch
cause "add -p" (and related commands) to recognize that line
and explicitly ask about deleting the file.
We only add the "stage this deletion" hunk for empty files,
since other files will already ask about the big content
deletion hunk. We could also change those files to simply
display "stage this deletion", but showing the actual
deleted content is probably what an interactive user wants.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Usually we show deletion as a big hunk deleting all of the
file's text. However, for files with no content, the diff
shows just the 'deleted file mode ...' line. This patch
cause "add -p" (and related commands) to recognize that line
and explicitly ask about deleting the file.
We only add the "stage this deletion" hunk for empty files,
since other files will already ask about the big content
deletion hunk. We could also change those files to simply
display "stage this deletion", but showing the actual
deleted content is probably what an interactive user wants.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-add--interactive.perl | diff | blob | history | |
t/t3701-add-interactive.sh | diff | blob | history |