Skip to content

Commit

Permalink
git-reset <tree> -- <path> restores absense of <path> in <tree>
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jan 7, 2007
1 parent e9c8409 commit bc8c029
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions git-reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ if test $# != 0
then
test "$reset_type" == "--mixed" ||
die "Cannot do partial $reset_type reset."
git ls-tree -r --full-name $rev -- "$@" |
git update-index --add --index-info || exit

git-diff-index --cached $rev -- "$@" |
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/' |
git update-index --add --remove --index-info || exit
git update-index --refresh
exit
fi
Expand Down

0 comments on commit bc8c029

Please sign in to comment.