Re: Git archiving only branch work
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:02:56
Duy Nguyen [off-list ref] writes:
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.
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.