[PATCH 2/2] git-reset <tree> -- <path> restores absense of <path> in <tree>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 
 * By the way, I noticed that "git log --diff-filter=A --
   t/t5401-update-hooks.sh" does not find the commit that
   introduced the path.  v1.4.1.1 seems to work but v1.4.2.4
   does not.  I haven't bisected it yet...

 git-reset.sh |    6 ++++--
 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
-- 
1.5.0.rc0.ge0f6


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]