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

"checkout-cache" update

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 21, 2005, 17:40 UTC
Message-ID
<Pine.LNX.4.58.0504211027500.2344@ppc970.osdl.org>

I just pushed out this very useful thing to "checkout-cache", which is best just described by its commit log:

  Add the ability to prefix something to the pathname to "checkout-cache.c"
  
  This basically makes it trivial to use checkout-cache as a "export as
  tree" function. Just read the desired tree into the index, and do a
  
        checkout-cache --prefix=export-dir/ -a
  
  and checkout-cache will "export" the cache into the specified directory.
  
  NOTE! The final "/" is important. The exported name is literally just
  prefixed with the specified string, so you can also do something like
  
        checkout-cache --prefix=.merged- Makefile
  
  to check out the currently cached copy of "Makefile" into the file
  ".merged-Makefile".
Basically, I can do a a "git-0.6" release with a simple
	checkout-cache --prefix=../git-0.6/ -a

which basically says: check out all files, but use the prefix "../git-0.6/" before the filename when you do so.

Then I just do
	cd ..
	tar czvf git-0.6.tar.gz git-0.6
and I'm done. Very cool, very simple, and _extremely_ fast.

Doing the tree export (not the tar) for the whole kernel takes two minutes in the cold-cache case (not so wonderful, but acceptable), and 4.6 _seconds_ in the hot-cache case (pretty damn impressive, I say).

(The compressng tar then takes about 20 seconds for me, and that's obviously all from the cache, since I just wrote it out).

NOTE! The fact that the '/' at the end of the --prefix= thing is meaningful can be very confusing, I freely admit. But it does end up being potentially quite useful, and you're likely to script usage of this anyway into "git export" or something, so...

		Linus
Message 1 of 1 in “"checkout-cache" update”
  1. Linus TorvaldsApr 21, 2005

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.