On Thu, Feb 16, 2023 at 12:41:42PM -0700, Raul E Rangel wrote: > When generating a tarball with `git archive <tree>`, `git archive` will > use the current time as the mtime. This results in a non-hermetic > tarball. Could we should add a --mtime option that allows passing in > the time? That seems like a very reasonable feature to have. Just to sketch out the implementation, in case anybody wants to work on it: - options are read first in cmd_archive(), but it passes unknown ones on to write_archive(), which is where we parse the interesting ones. - that relies on parse_archive_args() in archive.c. So we'd want a new option in opts[] there, and to write the value into a new field in the archiver_args struct. - the time is filled in via parse_treeish_arg(), where we use time(NULL) if there's no commit. And there we'd just use the value from archiver_args. If there is a commit and they've specified --mtime, what should happen? Quietly ignore it? Override the commit's timestamp? Complain and bail? - I didn't look at how this might interact with "git archive --remote". I think it might just all work, as we just ship the options to the other side, which parses them itself using the same code. -Peff