Vivien Kraus <viv...@planete-kraus.eu> writes: > Hello, > > Le lundi 24 février 2025 à 19:10 +0100, Bruno Haible via Gnulib > discussion list a écrit : >> The "version-controlled modification time" vc_mtime(F) of a file F >> is defined as: >> - If F is under version control and not modified locally: >> the time of the last change of F in the version control >> system. >> - Otherwise: The modification time of F on disk. > > How does that work if you are running from the extraction of a git > archive? According to https://git-scm.com/docs/git-archive, you can > pass: > > --mtime=<time> > Set modification time of archive entries. Without this option the > committer time is used if <tree-ish> is a commit or tag, and the > current time if it is a tree. > > So it appears that running git archive destroys the modification time, > right? > > In a module I closely associate with this, git-version-gen, you can > have an escape hatch in the form of the ".tarball-version" file, so you > could insert a .tarball-version in the git archive and it would still > get the version correctly. Would it make sense to search for a > companion ".source-mtime" file next to the file of interest, or some > meaningful name?
Interesting! Is what you are looking for some .gitattribute export-subst keywords for source-file modification times, and that could be understood by vc-mtime or some other script. Similar to how git-version-gen now supports .tarball-version-git via the same mechanism. I believe being able to build any project from a 'git archive' generated tarball is a worthwhile goal. I think 'git archive' is the only stable serialized archival format used to collect the sources that went into creating the 'make dist' tarballs (which I also believe are wortwhile to publish). It seems some set of users (distributions) are sometimes not helped by using 'make dist' tarballs, since it introduces licenses concerns (did we really rebuild all generated files?) and technical issues (how to rebuild all generated files?). Using the 'git archive' tarballs short-circuits several of those questions. Personally I use tar --mtime to the latest git commit time instead of the complexity of the vc-mtime approach. I've done two software releases with this approach (libtasn1, inetutils) and no reports of problems so far, but I'm open to the idea that this is a too primitive approach. I'm hoping saying "please use GNU make" will be a sustainable answer though. /Simon
signature.asc
Description: PGP signature