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

Re: Adding files to a git-archive when it is generated, and whats the best way to find out what branch a commit is on?

From: demerphq <hidden>
Date: 2016-06-15 22:47:08

2009/7/30 René Scharfe [off-list ref]:
demerphq schrieb:
quoted
So then git also would benefit from support in git-archive for adding
arbitrary files to the archive during generation?
Yes, and this has come up before.

How about the following?  It's missing documentation and a test case,
but you could try

       $ git archive --add-file extra HEAD >HEAD+extra.tar

or

       $ git archive --prefix=a/ --add-file extra --prefix=b/ HEAD >ba.tar

Only the file name part (after the last slash) of the extra file is used,
together with the prefix, to form the path of the archive entry.

Opening the extra files when parsing the command line arguments and closing
them after they have been written into the archive is a bit iffy, but it's
impractical to report open errors after parts of the archive have already
been created.
I havent managed to try it out yet but this is pretty much exactly
what I was looking for. Only thought I had was that it might be nice
to be able to specify what name the file should be added as so that
you can add files to subpaths deeper than the root/root prefix of the
tar. However for /my/ particular purposes that is unnecessary, it only
occurs to me as a nice to have. But if you were inclined to think
about extending it I was thinking an argument notation like --add-file
foo:bar/baz/bop might be useful.

Anyway, thanks a lot, assuming it works ok, which I'm sure it does,
even if it doesn't get accepted to git it is likely we will build a
git that does use it for the perl gitweb site. Much appreciated.

cheers,
Yves



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help