Re: Feature request: Add --mtime option to git archive
- From
- Raul Rangel <rrangel@chromium.org>
- Date
- Feb 17, 2023, 15:43 UTC
- Message-ID
- <CAHQZ30Dq1_vdJj_hakqXKFUbuqn9ysNsw-zzN83RmUVbibA3Gw@mail.gmail.com>
- In-Reply-To
- <xmqqpma9m4i1.fsf@gitster.g>
On Thu, Feb 16, 2023 at 7:04 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 29 quoted lines
>
> Jeff King <peff@peff.net> writes:
>
> > A similar option in is to simply start using "0" in the meantime, like:
> >
> > diff --git a/archive.c b/archive.c
> > index 81ff76fce9..48d89785c3 100644
> > --- a/archive.c
> > +++ b/archive.c
> > @@ -470,7 +470,7 @@ static void parse_treeish_arg(const char **argv,
> > archive_time = commit->date;
> > } else {
> > commit_oid = NULL;
> > - archive_time = time(NULL);
> > + archive_time = 0;
> > }
> >
> > tree = parse_tree_indirect(&oid);
> >
> > Nobody will complain about changing the byte-for-byte format, since by definition it
> > was already changing once per second (cue somebody complaining that they
> > have been using LD_PRELOAD tricks to simulate --mtime).
> >
> > I do wonder if people would complain (both with the patch above and with
> > brian's proposal) that the resulting tarballs extract everything with a
> > date in 1970. That's not functionally a problem, but it looks kind of
> > weird in "ls -l".
>
> And owned by root:root ;-)I fully support both of those easy changes. Only reason I proposed --mtime was that https://reproducible-builds.org/docs/archives/ recommends setting SOURCE_DATE_EPOCH, but honestly for my purposes I would always use 0 and root:root.
Show 5 quoted lines
> > I am sure people would complain. What matters is if these > complaints have merit, and in this case, I doubt it. I especially > like your "it has been already changing once per second" reasoning > for this change.