git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
JRJuergen Ruehle <j.ruehle@bmiag.de>
Date
Jan 5, 2007, 16:17 UTC
Message-ID
<17822.31277.52000.636821@lapjr.intranet.kiel.bmiag.de>
In-Reply-To
<7vmz4xiz6t.fsf@assigned-by-dhcp.cox.net>
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
Previous: Junio C Hamano
Message 4 of 4 in “git-reset <tree> -- <path> restores absense of <path> in <tree>”
  1. 2/2 git-reset <tree> -- <path> restores absense of <path> in <tree>Junio C Hamano, Jan 5, 2007
  2. Johannes SchindelinJan 5, 2007
  3. Junio C HamanoJan 5, 2007
  4. Juergen RuehleJan 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.