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

Re: Git archiving only branch work

From
Jeff King <peff@peff.net>
Date
Nov 13, 2014, 20:06 UTC
Message-ID
<20141113200640.GB3869@peff.net>
In-Reply-To
<20141113133615.GA28346@lanh>
On Thu, Nov 13, 2014 at 08:36:16PM +0700, Duy Nguyen wrote:
Show 20 quoted lines
> On Thu, Nov 13, 2014 at 12:32:40PM +0000, Graeme Geldenhuys wrote:
> > [alias]
> >     deploy = !sh -c 'git archive --prefix=$1/ -o deploy_$1.zip HEAD 
> > $(git diff --name-only -D $2)' -
> > 
> > This works very well. The only problem we have so far is that if we 
> > have files with spaces in the name (eg: SQL update scripts), then the 
> > command breaks.
> > 
> > Does anybody have an idea on how this can be resolved?  Any help would 
> > be much appreciated.
> 
> I wonder if it's overkill to do something like this patch ("git
> archive" may need some more updates for it to work though). With it
> you can do:
> 
>   git diff --name-only ... | git archive ... HEAD -- ":(file)-"
> 
> The good thing is it works for other commands as well. But is it
> really a good thing..

I like the idea of taking paths from stdin (and especially if there is a "-z" option). But using a pathspec that reads from stdin seems like it creates a lot of corner cases. What would:

  git rev-list --stdin -- ":(file)-"

do? It is kind of neat that you could read from multiple files (besides stdin), but I'm not sure it is all that useful in practice (you can always cat them to its stdin).

How about just adding --stdin, which matches other git commands?
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 13 in “Git archiving only branch work”
  1. Graeme GeldenhuysNov 13, 2014
  2. Peter KreftingNov 13, 2014
  3. Duy NguyenNov 13, 2014
  4. Junio C HamanoNov 13, 2014
  5. Jeff KingNov 13, 2014
  6. Junio C HamanoNov 13, 2014
  7. Jeff KingNov 13, 2014
  8. Junio C HamanoNov 13, 2014
  9. Jeff KingNov 13, 2014
  10. Junio C HamanoNov 13, 2014
  11. Jeff KingNov 14, 2014
  12. Junio C HamanoNov 14, 2014
  13. Thomas KochNov 13, 2014

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.