All of lore.kernel.org
 help / color / mirror / Atom feed
* Could GIT manage revision headers embedded in code ?
@ 2017-05-02 11:48 Delanoe Eric
  2017-05-02 12:11 ` Christian Couder
  2017-05-02 15:54 ` Johannes Schindelin
  0 siblings, 2 replies; 4+ messages in thread
From: Delanoe Eric @ 2017-05-02 11:48 UTC (permalink / raw)
  To: git

Hello,

We need a great deal of traceability for our source, made of many scripts in interpreted languages, spread in many "independent" modules, as far as can be ;-).
In particular, somebody troubleshooting a script in production should be able to know exactly the revision or commit ID (or tag label) of a given file, and its location in the GIT source directory tree.

Our old CVS... let's say it was its only advantage... was doing this with keywords embedded in code comments: $Header$, $Id$, $Rev$, $File$ etc... When a file was committed, its $Header$ keyword was expanded into a rich piece of "version" information like '' $Header: /cvsstore/SourcesOracle/Install/COMMUN/CST.sql,v 1.69.2.10 2017/04/14 09:38:48 edelanoe $".

Could this kind of "keyword expansion" feature be added into GIT ?
Focusing on the goal: enable the identification of a file and its revision(*) inside the committed code itself.
(*) the "revision" information or a commit ID. The tag(s) attached at commit time would be less reliable, as a tag can be moved between revisions.

Thank you in advance for any answer,
Best regards,
E.Delanoë

Grenobloise d'Electronique et d'Automatismes
Inovallée - 12, Chemin de Malacher
38243 MEYLAN CEDEX 
FRANCE

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Could GIT manage revision headers embedded in code ?
  2017-05-02 11:48 Could GIT manage revision headers embedded in code ? Delanoe Eric
@ 2017-05-02 12:11 ` Christian Couder
  2017-05-02 13:33   ` Delanoe Eric
  2017-05-02 15:54 ` Johannes Schindelin
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Couder @ 2017-05-02 12:11 UTC (permalink / raw)
  To: Delanoe Eric; +Cc: git

Hi,

On Tue, May 2, 2017 at 1:48 PM, Delanoe Eric <e.delanoe@gea.fr> wrote:
> Hello,
>
> We need a great deal of traceability for our source, made of many scripts in interpreted languages, spread in many "independent" modules, as far as can be ;-).
> In particular, somebody troubleshooting a script in production should be able to know exactly the revision or commit ID (or tag label) of a given file, and its location in the GIT source directory tree.
>
> Our old CVS... let's say it was its only advantage... was doing this with keywords embedded in code comments: $Header$, $Id$, $Rev$, $File$ etc... When a file was committed, its $Header$ keyword was expanded into a rich piece of "version" information like '' $Header: /cvsstore/SourcesOracle/Install/COMMUN/CST.sql,v 1.69.2.10 2017/04/14 09:38:48 edelanoe $".
>
> Could this kind of "keyword expansion" feature be added into GIT ?

You can already do it with "smudge" and "clean" filters. Look for
"Keyword Expansion" in:

https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: Could GIT manage revision headers embedded in code ?
  2017-05-02 12:11 ` Christian Couder
@ 2017-05-02 13:33   ` Delanoe Eric
  0 siblings, 0 replies; 4+ messages in thread
From: Delanoe Eric @ 2017-05-02 13:33 UTC (permalink / raw)
  To: Christian Couder; +Cc: git

Thank you for your quick answer.
And great answer ! I'm looking forward to try this.

Thanks again and best regards,
E.Delanoë


-----Message d'origine-----
De : Christian Couder [mailto:christian.couder@gmail.com] 
Envoyé : mardi 2 mai 2017 14:11
À : Delanoe Eric
Cc : git@vger.kernel.org
Objet : Re: Could GIT manage revision headers embedded in code ?

Hi,

On Tue, May 2, 2017 at 1:48 PM, Delanoe Eric <e.delanoe@gea.fr> wrote:
> Hello,
>
> We need a great deal of traceability for our source, made of many scripts in interpreted languages, spread in many "independent" modules, as far as can be ;-).
> In particular, somebody troubleshooting a script in production should be able to know exactly the revision or commit ID (or tag label) of a given file, and its location in the GIT source directory tree.
>
> Our old CVS... let's say it was its only advantage... was doing this with keywords embedded in code comments: $Header$, $Id$, $Rev$, $File$ etc... When a file was committed, its $Header$ keyword was expanded into a rich piece of "version" information like '' $Header: /cvsstore/SourcesOracle/Install/COMMUN/CST.sql,v 1.69.2.10 2017/04/14 09:38:48 edelanoe $".
>
> Could this kind of "keyword expansion" feature be added into GIT ?

You can already do it with "smudge" and "clean" filters. Look for "Keyword Expansion" in:

https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Could GIT manage revision headers embedded in code ?
  2017-05-02 11:48 Could GIT manage revision headers embedded in code ? Delanoe Eric
  2017-05-02 12:11 ` Christian Couder
@ 2017-05-02 15:54 ` Johannes Schindelin
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2017-05-02 15:54 UTC (permalink / raw)
  To: Delanoe Eric; +Cc: git

Hi Eric,

On Tue, 2 May 2017, Delanoe Eric wrote:

> Could this kind of "keyword expansion" feature be added into GIT ?

Back in the days, it was decided that this should be part of the "export
as zip" functionality, see the `export-subst` feature in git-archive's and
gitattributes' documentation.

In reality, what most projects do is to generate a header or some such as
part of their build process. Git itself may serve as a case in point:

	https://github.com/git/git/blob/master/GIT-VERSION-GEN

used in

	https://github.com/git/git/blob/v2.12.2/Makefile#L390-L392

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-02 15:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02 11:48 Could GIT manage revision headers embedded in code ? Delanoe Eric
2017-05-02 12:11 ` Christian Couder
2017-05-02 13:33   ` Delanoe Eric
2017-05-02 15:54 ` Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.