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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Juergen Ruehle
Date: Friday, January 5, 2007 - 9:17 am

Junio C Hamano writes:
 > 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.

Great! It took some time, but I think I understand now why the first
part was even necessary:-)

 > 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

All other scripts calling update-index --index-info don't mention
add/remove (which are ignored anyway). Might be useful as a reminder
though.

 >  	git update-index --refresh
 >  	exit
 >  fi

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 2/2] git-reset <tree> -- <path> restores absens ..., Juergen Ruehle, (Fri Jan 5, 9:17 am)