git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: demerphq <demerphq@gmail.com>
Cc: "Santi Béjar" <santi@agolina.net>, Git <git@vger.kernel.org>,
	"Jakub Narebski" <jnareb@gmail.com>
Subject: 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?
Date: Tue, 04 Aug 2009 19:50:04 +0200	[thread overview]
Message-ID: <4A7874CC.9050702@lsrfire.ath.cx> (raw)
In-Reply-To: <9b18b3110908020719h79cf4872p9f284346cd6a185b@mail.gmail.com>

demerphq schrieb:
> One solution is to do the work in a process specific temporary
> directory with the correct name and then add it that way.
> 
> A slightly nicer approach is create the file in a common working
> directory with a temporary name and then have it added to the archive
> with a different name. This is actually the approach I used by
> exploiting the the --transform option to tar. So while it might appear
> my request is a YAGNI it is actually a IADNI (I Already Did Need It).
> 
> Even nicer and cleaner of course would be support something like
> "--add-file -=.patch"  with the "-" meaning "read from STDIN", which
> then means temporary files can be avoided, assuming one only needs to
> add a single file to the archive. This is particularly nice if the
> content of  the file can be generated from the output of something
> like git-describe or git rev-parse or any generic tool.

This case (single file in archive, contents from stdin) could be handled
by another option, e.g. named --add-stdin <name_in_archive>, without
resorting to multi-valued option parameters.

Also, if a file can be generated using a --pretty=format: string, then
you can let git-archive expand a checked-in template by setting the
attribute export-subst.  This works for multiple files, but doesn't if
you need git-describe style output (yet).

> So IMO actually this functionality would be very useful, and isnt so
> weird when you think of it in context of generating snapshots for a
> "git aware" build process.

No doubt about it.  The question is: how to expose such functionality?
Perhaps all that is needed for your purposes is a format place-holder
for git-describe output?

(git itself needs more: in addition to the files "version" and
"git.spec", which could benefit from such a place-holder, it adds the
generated "configure" script and "git-gui/version" to the tarball.)

René

  reply	other threads:[~2009-08-04 17:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29  8:15 Adding files to a git-archive when it is generated, and whats the best way to find out what branch a commit is on? demerphq
2009-07-29  8:40 ` Avery Pennarun
2009-07-29  8:41 ` Santi Béjar
2009-07-29  9:21   ` demerphq
2009-07-29  9:33     ` Santi Béjar
2009-07-29  9:51       ` demerphq
2009-07-29 11:13         ` Santi Béjar
2009-07-30 20:33     ` René Scharfe
2009-07-31 10:04       ` demerphq
     [not found]         ` <m3hbwtrpip.fsf@localhost.localdomain>
2009-07-31 13:48           ` demerphq
2009-08-02 13:52         ` René Scharfe
2009-08-02 14:19           ` demerphq
2009-08-04 17:50             ` René Scharfe [this message]
2009-07-29 16:12 ` Jeff Epler

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=4A7874CC.9050702@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=demerphq@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=santi@agolina.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).