Re: Git archiving only branch work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Duy Nguyen <pclouds@xxxxxxxxx> 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.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]