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

Re: [PATCH] make cg-export use tar-tree

From
Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Apr 27, 2005, 01:16 UTC
Message-ID
<426EE7E9.5010108@lsrfire.ath.cx>
In-Reply-To
<200504261928.44538.jcorbin@wunjo.org>
Joshua T. Corbin schrieb:
> Here it is (this time with real tabs instead of two spaces ;) ), requires 
> Rene's tar-tree patch. Works quite speedily too I might add.

Maybe it's just Thunderbird, but I see single spaces instead of tabs there.

Show 15 quoted lines
> +  tar=$(mktemp -t cg-export.tar.XXXXXX)
> +  tar-tree $id "$base" > $tar
> +  case $ext in
> +  .tar.gz|.tgz)
> +   gzip -c9 $tar > $dest
> +   rm -f $tar
> +   ;;
> +  .tar.bz2)
> +   bzip2 -c $tar > $dest
> +   rm -f $tar
> +   ;;
> +  .tar)
> +   mv $tar $dest
> +   ;;
> +  esac

You don't need to create a temporary file using tar-tree. The above can be done like this:

  case $ext in
  .tar.gz|.tgz)
      tar-tree $id "$base" | gzip -9
      ;;
  .tar.bz2)
      tar-tree $id "$base" | bzip2
      ;;
  .tar)
      tar-tree $id "$base"
      ;;
  esac > $dest

This is both shorter and (a bit) faster. More easily readable, too, IMO. Don't fear the pipe. ;-) And I don't think we need to avoid the triplication of tar-tree calls.

Thanks, Rene

Message 1 of 1 in “Re: [PATCH] make cg-export use tar-tree”
  1. Rene ScharfeApr 27, 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.