Skip to content
  • Jeff King's avatar
    add-interactive: fix deletion of non-empty files · 8947fdd5
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    Commit 24ab81ae
    
     fixed the deletion of empty files, but broke
    deletion of non-empty files. The approach it took was to
    factor out the "deleted" line from the patch header into its
    own hunk, the same way we do for mode changes. However,
    unlike mode changes, we only showed the special "delete this
    file" hunk if there were no other hunks. Otherwise, the user
    would annoyingly be presented with _two_ hunks: one for
    deleting the file and one for deleting the content.
    
    This meant that in the non-empty case, we forgot about the
    deleted line entirely, and we submitted a bogus patch to
    git-apply (with "/dev/null" as the destination file, but not
    marked as a deletion).
    
    Instead, this patch combines the file deletion hunk and the
    content deletion hunk (if there is one) into a single
    deletion hunk which is either staged or not.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    8947fdd5