git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: RCS keyword expansion

From
OKOliver Kullmann <o.kullmann@swansea.ac.uk>
Date
Oct 11, 2007, 15:59 UTC
Message-ID
<20071011155956.GC11693@cs-wsok.swansea.ac.uk>
In-Reply-To
<86fy0hvgbh.fsf@blue.stonehenge.com>
On Thu, Oct 11, 2007 at 08:09:22AM -0700, Randal L. Schwartz wrote:
Show 11 quoted lines
> >>>>> "Peter" == Peter Karlsson <peter@softwolves.pp.se> writes:
> 
> Peter> I mainly want to have $Date$ expand in RCS/CVS manner, i.e to when the
> Peter> file was last changed. Possibly even have an $Id$ that gives me
> Peter> something useful (name and commit hash, perhaps?). Is it possible to do
> Peter> this? Can it be done through git-cvsserver?
> 
> That's not a job for a source code manager to do.  It's a job for your
> build/install tool.  See how "git --version" gets created in the core distro,
> and follow that example.
> 

This looks like a misunderstanding of what $Date$ is used for: It has not much to do with a version number (such things are decisions by the developers), but it is an identification stamp, typically used to identify exactly which piece of code is involved in a given executable.

Our group also needs a replacement for the keyword-expansion mechanism (we are using a nice little system, which allows for each executable produced to query it about the source-code-files involved in it, which is especially useful for testing and development, where many versions of many files float around (and perhaps some shouldn't)).

The principle solution seems quite clear to me: Adapt the pre-commit hook, so that files are scanned for the keyword, and apply the keyword expansion then before the actual commit.

Better than just the date, it would be greatest to be able to put also the SHA1-ID of the commit into the file, alas this is a bit complicated, since it's a pre-commit hook; However it seems necessary to have in the repository really the actual file content, not "modulo some modification", due to the distributed character of Git repositories (everybody should have the same file-timestamp), and so a post-commit hook shouldn't be used. So well, using the previous SHA1-ID should be a reasonable approximation.

Oliver
Previous: Randal L. SchwartzNext: Alex Riesen
Message 4 of 27 in “RCS keyword expansion”
  1. Peter KarlssonOct 11, 2007
  2. Johannes SixtOct 11, 2007
  3. Randal L. SchwartzOct 11, 2007
  4. Oliver KullmannOct 11, 2007
  5. Alex RiesenOct 11, 2007
  6. Johannes SchindelinOct 11, 2007
  7. Sam VilainOct 11, 2007
  8. Peter KarlssonOct 12, 2007
  9. Johannes SchindelinOct 12, 2007
  10. Peter KarlssonOct 12, 2007
  11. Johannes SixtOct 12, 2007
  12. Lars HjemliOct 12, 2007
  13. Johannes SchindelinOct 12, 2007
  14. Peter KarlssonOct 15, 2007
  15. Johannes SchindelinOct 15, 2007
  16. Jan HudecOct 12, 2007
  17. Salikh ZakirovOct 12, 2007
  18. Johannes SchindelinOct 12, 2007
  19. Zakirov SalikhOct 12, 2007
  20. Peter KarlssonOct 11, 2007
  21. Alex RiesenOct 11, 2007
  22. Peter KarlssonOct 12, 2007
  23. Barry FishmanOct 12, 2007
  24. Linus TorvaldsOct 12, 2007
  25. Florian WeimerOct 12, 2007
  26. Sam VilainOct 11, 2007
  27. Lars HjemliOct 11, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.