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

Re: [PATCH] cg-export to tarball

From
Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Apr 26, 2005, 22:24 UTC
Message-ID
<426EBF8E.5000906@lsrfire.ath.cx>
In-Reply-To
<20050426202014.GJ13224@pasky.ji.cz>
Petr Baudis schrieb:
Show 12 quoted lines
> Dear diary, on Tue, Apr 26, 2005 at 09:12:46AM CEST, I got a letter 
> where "Joshua T. Corbin" <jcorbin@wunjo.org> told me that...
> 
>> The following patch to cg-export will simlpy create a tarball if 
>> the argument ends in .tar.gz, .tar.bz2, or .tar.
>> 
>> Signed-off-by; Joshua T. Corbin <jcorbin@wunjo.org>
> 
> 
> What about cooperating with Rene Scharfe and using his tar-tree? I 
> didn't actually try it yet (not even look at the code so far), it'd 
> be cool if someone would give it some review and testing.
Yes, this looks like a job for tar-tree.  You could do something like this:
   destbasename=${destdir##*/}
   case "$destdir" in
   *.tar)
       tar-tree $id "${destbasename%.tar}" > "$destdir"
       ;;
   *.tgz)
       tar-tree $id "${destbasename%.tgz}" | gzip -9 > "$destdir"
       ;;
   # *.tar.gz, *.tar.bz2, ...
   *)
       mkdir -p "$destdir" || die "cannot create $destdir"
       export GIT_INDEX_FILE="$destdir/.git-index"
       read-tree $id
       checkout-cache "--prefix=$destdir/" -a
       rm "$GIT_INDEX_FILE"
       ;;
   esac

The second parameter to tar-tree is an optional prefix for all paths inside the archive (official kernel tarballs always have linux-2.x.xx as a prefix). It makes some sense to set this value to the archive filename, "cg-export linux-2.6.12-rc3.tar.bz2" would than work as expected.

What do you think? If you like it I'll cook up a patch later unless you beat me to it.

Thanks, Rene

Previous: Petr Baudis
Message 3 of 3 in “cg-export to tarball”
  1. cg-export to tarballJoshua T. Corbin, Apr 26, 2005
  2. Petr BaudisApr 26, 2005
  3. Rene ScharfeApr 26, 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.