On Fri, Sep 09, 2011 at 08:44:12PM +0200, Lukas Fleischer wrote:
> On Thu, Sep 08, 2011 at 04:38:28PM -0500, Dan McGee wrote:
> > We don't need to invoke svn copy on each file; it accepts multiple
> > arguments. This cut Allan's time releasing one patch-friendly package
> > from 5 minutes to 2 minutes.
> > 
> > Signed-off-by: Dan McGee <[email protected]>
> > ---
> >  archrelease |    5 ++---
> >  1 files changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/archrelease b/archrelease
> > index 2f6a563..7bb4c8a 100755
> > --- a/archrelease
> > +++ b/archrelease
> > @@ -52,9 +52,8 @@ for tag in "$@"; do
> >             svn add --parents -q "repos/$tag"
> >     fi
> >  
> > -   for file in "${known_files[@]}"; do
> > -           svn copy -q -r HEAD "$trunk/$file" "repos/$tag/"
> > -   done
> > +   # copy all files at once from trunk to the subdirectory in repos/
> > +   svn copy -q -r HEAD ${known_files[@]/#/$trunk/} "repos/$tag/"
> 
> +1 from me. I wondered why we were looping over the single files in the
> first place. However, if we copy from current HEAD anyway, I don't see
> any reason to not just use `svn copy -q -r HEAD "$trunk/" "repos/$tag/"`
> here.
> 

+1 from me provided we quote the array expansion.

  $ known_files=(foo "bar baz") trunk=/some/path

  $ printf '%s\n' ${known_files[@]/#/$trunk/}
  /some/path/foo
  /some/path/bar
  baz

  $ printf '%s\n' "${known_files[@]/#/$trunk/}"
  /some/path/foo
  /some/path/bar baz

d

Reply via email to