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

Re: update-index --index-info producing spurious submodule commits

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 20, 2011, 02:15 UTC
Message-ID
<20110820021430.GA14281@elie.sbx02827.chicail.wayport.net>
In-Reply-To
<rmi39gxacp1.fsf@fnord.ir.bbn.com>
Greg Troxel wrote:
> Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
>> "ls-tree -r HEAD foo" is probably what you meant to say.
>
> Thanks very much for the clue - that works.  The update-index
> documentation should probably say that only blobs (or perhaps commits
> intended to be submodules??) are acceptable, and perhaps say "ls-tree
> -r" instead of ls-tree.
Makes sense.  Please make it so.
By the way, for this particular application I wonder if something like
	git ls-files -z <dir> | git update-index -z --force-remove --stdin
	git read-tree --prefix=<dir>/ <tree>
would be easier.  Or a commit-filter. :)
	tree=$1
	shift
	tree=$(
		git ls-tree -z "$tree" |
		perl -0ne '
			chop;
			my ($info, $name) = split(/\t/, $_, 2);
			if ($name eq "<dir>") {
				printf("040000 tree <good tree>\t<dir>\0");
			} else {
				printf("%s\0", $_);
			}
		' |
		git mktree -z
	)
	git commit-tree "$tree" "$@"

Thanks, Jonathan

Previous: Greg TroxelNext: Junio C Hamano
Message 6 of 7 in “update-index --index-info producing spurious submodule commits”
  1. Greg TroxelAug 18, 2011
  2. Junio C HamanoAug 18, 2011
  3. Greg TroxelAug 19, 2011
  4. Junio C HamanoAug 19, 2011
  5. Greg TroxelAug 19, 2011
  6. Jonathan NiederAug 20, 2011
  7. Junio C HamanoAug 19, 2011

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.