Code

add--interactive: handle initial commit better
authorJeff King <peff@peff.net>
Wed, 13 Feb 2008 10:50:51 +0000 (05:50 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sat, 16 Feb 2008 09:02:44 +0000 (01:02 -0800)
commit18bc76164dbf4f6d54b8fa9c9c29db9ca66c7877
tree3aee5a6be8dd3c05d8db162cf4ba61c5dca30d3c
parent346245a1bb6272dd370ba2f7b9bf86d3df5fed9a
add--interactive: handle initial commit better

There were several points where we looked at the HEAD
commit; for initial commits, this is meaningless. So instead
we:

  - show staged status data as a diff against the empty tree
    instead of HEAD
  - show file diffs as creation events
  - use "git rm --cached" to revert instead of going back to
    the HEAD commit

We magically reference the empty tree to implement this.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-add--interactive.perl
t/t3701-add-interactive.sh [new file with mode: 0755]