summaryrefslogtreecommitdiff
path: root/git-reset.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-01-05 09:38:56 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-07 06:57:42 (GMT)
commitbc8c0294c6ab673e465a8b564e22b1b9c2a2ea50 (patch)
tree64b5d27d4ab388cf4553f037f523800230e7f25a /git-reset.sh
parente9c8409900fc84cd7721117c98dfe01acd535aa2 (diff)
downloadgit-bc8c0294c6ab673e465a8b564e22b1b9c2a2ea50.zip
git-bc8c0294c6ab673e465a8b564e22b1b9c2a2ea50.tar.gz
git-bc8c0294c6ab673e465a8b564e22b1b9c2a2ea50.tar.bz2
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>
Diffstat (limited to 'git-reset.sh')
-rwxr-xr-xgit-reset.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-reset.sh b/git-reset.sh
index a969370..76c8a81 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -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