Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: Git archiving only branch work

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:02:56

Jeff King [off-list ref] writes:
On Thu, Nov 13, 2014 at 08:36:16PM +0700, Duy Nguyen wrote:
quoted
On Thu, Nov 13, 2014 at 12:32:40PM +0000, Graeme Geldenhuys wrote:
quoted
[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?
How about doing nothing and use the correct $IFS instead?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help