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

Re: [PATCH] cogito: Avoid slowness when timewarping large trees.

From
Junio C Hamano <junkio@cox.net>
Date
Mar 24, 2006, 10:21 UTC
Message-ID
<7vd5gc16u2.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060324084423.GA30213@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 23 quoted lines
> tree_timewarp was calling read, egrep, and rm in an O(N) loop where N is
> the number of changed files between two trees. This caused a bottleneck
> when seeking/switching/merging between trees with many changed files.
>...
> ---
>
>  cg-Xlib |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
>
> a9a160c0bd63973c53ba3aa74650728135d23ac7
> diff --git a/cg-Xlib b/cg-Xlib
> index a2f28cf..ceddeeb 100644
> --- a/cg-Xlib
> +++ b/cg-Xlib
> @@ -345,12 +345,9 @@ tree_timewarp()
>  
>  	# Kill gone files
>  	git-diff-tree -r "$base" "$branch" |
> ...
> +		# match ":100755 000000 14d43b1abf... 000000000... D"
> +		sed -ne 's/^:\([^ ][^ ]* \)\{4\}D\t//p' |
> +		xargs rm --
>  	git-checkout-index -u -f -a

Metainformation fields are internally separated with SP and a TAB comes before pathname; you can just say:

	sed -ne 's/^:[^	]* D	//p'

there (whitespace inside [] and after D are TAB; one before D is a SP). You might also want to consider "xargs rm -f --", BTW.

However, I wonder why it does not do this instead:
	... stash away the local changes
	git-read-tree -m "$base" ;# reset the index to $base
	# switch to $branch -- removing gone files as well
	git-read-tree -m -u "$base" "$branch"
Then you can also lose diff-tree and checkout-index there.
Previous: Jeff KingNext: Jeff King
Message 2 of 10 in “cogito: Avoid slowness when timewarping large trees.”
  1. cogito: Avoid slowness when timewarping large trees.Jeff King, Mar 24, 2006
  2. Junio C HamanoMar 24, 2006
  3. Jeff KingMar 24, 2006
  4. Junio C HamanoMar 24, 2006
  5. Jeff KingMar 24, 2006
  6. Shawn PearceMar 24, 2006
  7. Jeff KingMar 25, 2006
  8. Avoid slowness when timewarping large trees.Jeff King, Mar 25, 2006
  9. Petr BaudisMar 26, 2006
  10. Junio C HamanoMar 25, 2006

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.