All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Duy Nguyen <pclouds@gmail.com>
Cc: Graeme Geldenhuys <mailinglists@geldenhuys.co.uk>, git@vger.kernel.org
Subject: Re: Git archiving only branch work
Date: Thu, 13 Nov 2014 08:49:19 -0800	[thread overview]
Message-ID: <xmqqlhnf2ghc.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20141113133615.GA28346@lanh> (Duy Nguyen's message of "Thu, 13 Nov 2014 20:36:16 +0700")

Duy Nguyen <pclouds@gmail.com> writes:

> 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.

Set $IFS to newline, so that $(git diff --name-only ...) output is
split at record boundaries, not inside pathnames?

A quick experiment you can do to convince yourself may be:

-- >8 --
#!/bin/sh

data () {
	echo "a"
	echo "b c" ;# SP in between
	echo "d	e " ;# HT and trailing SP
}

show () {
	for i
	do
		echo "<<$i>>"
	done
}

echo ONE
show $(data)

IFS='
'

echo TWO
show $(data)
-- 8< --

On the "git archive" invocation, there may be something that tells
the pathspecs are literal, like '--literal-pathspecs' option, to
avoid metacharacters from being expanded, though.

  reply	other threads:[~2014-11-13 16:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-13 12:32 Git archiving only branch work Graeme Geldenhuys
2014-11-13 13:19 ` Peter Krefting
2014-11-13 13:36 ` Duy Nguyen
2014-11-13 16:49   ` Junio C Hamano [this message]
2014-11-13 20:06   ` Jeff King
2014-11-13 21:10     ` Junio C Hamano
2014-11-13 21:33       ` Jeff King
2014-11-13 21:36         ` Junio C Hamano
2014-11-13 21:39           ` Jeff King
2014-11-13 21:48             ` Junio C Hamano
2014-11-14 15:32               ` Jeff King
2014-11-14 20:35                 ` Junio C Hamano
2014-11-13 16:10 ` Thomas Koch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqlhnf2ghc.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mailinglists@geldenhuys.co.uk \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.