git-reset <tree> -- <path> restores absense of <path> in <tree>
When <path> exists in the index (either merged or unmerged), and <tree> does not have it, git-reset should be usable to restore the absense of it from the tree. This implements it. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 5, 2007 at 01:38 UTC
bc8c0294c6ab673e465a8b564e22b1b9c2a2ea50
1 file changed
+4
-2
git-reset.sh
+4
-2
@@ -44,8 +44,10 @@ if test $# != 0
44
then
45
test "$reset_type" == "--mixed" ||
46
die "Cannot do partial $reset_type reset."
47
- git ls-tree -r --full-name $rev -- "$@" |
48
- git update-index --add --index-info || exit
47
+
48
+ git-diff-index --cached $rev -- "$@" |
49
+ sed -e 's/^:\([0-7][0-7]*\) [0-7][0-7]* \([0-9a-f][0-9a-f]*\) [0-9a-f][0-9a-f]* [A-Z] \(.*\)$/\1 \2 \3/' |
50
+ git update-index --add --remove --index-info || exit
51
git update-index --refresh
52
exit
53
fi