Skip to content

Commit bc8c029

Browse files
author
Junio C Hamano
committed
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>
1 parent e9c8409 commit bc8c029

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

git-reset.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ if test $# != 0
4444
then
4545
test "$reset_type" == "--mixed" ||
4646
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
4951
git update-index --refresh
5052
exit
5153
fi

0 commit comments

Comments
 (0)