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

Re: Feature request: Add --mtime option to git archive

From
René Scharfe <l.s.r@web.de>
Date
Feb 17, 2023, 20:31 UTC
Message-ID
<83635ee4-02a2-dea7-38fa-c7b65c30c897@web.de>
In-Reply-To
<CAHQZ30Dq1_vdJj_hakqXKFUbuqn9ysNsw-zzN83RmUVbibA3Gw@mail.gmail.com>
Am 17.02.23 um 16:43 schrieb Raul Rangel:
Show 23 quoted lines
> On Thu, Feb 16, 2023 at 7:04 PM Junio C Hamano <gitster@pobox.com> wrote:
>>
>> 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).

And how are you now going to tell the current time on a remote git server? ;)

>>> 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".

Yes, 21st century artifacts being sent back in time looks a bit strange. GNU tar and bsdtar provide option -m to ignore mtimes when extracting.

Show 6 quoted lines
>> 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.
git archive already records root as user and group.
>> 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.
I find it quite convincing as well.
René
Previous: Raul RangelNext: Jeff King
Message 7 of 16 in “Feature request: Add --mtime option to git archive”
  1. Raul E RangelFeb 16, 2023
  2. Jeff KingFeb 16, 2023
  3. Junio C HamanoFeb 16, 2023
  4. Jeff KingFeb 17, 2023
  5. Junio C HamanoFeb 17, 2023
  6. Raul RangelFeb 17, 2023
  7. René ScharfeFeb 17, 2023
  8. Jeff KingFeb 17, 2023
  9. demerphqFeb 18, 2023
  10. brian m. carlsonFeb 18, 2023
  11. archive: add --mtimeRené Scharfe, Feb 18, 2023
  12. Junio C HamanoFeb 18, 2023
  13. René ScharfeFeb 19, 2023
  14. Junio C HamanoFeb 21, 2023
  15. Jeff KingFeb 22, 2023
  16. Junio C HamanoFeb 22, 2023

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.