From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
Raul E Rangel <rrangel@chromium.org>,
git@vger.kernel.org
Subject: Re: Feature request: Add --mtime option to git archive
Date: Thu, 16 Feb 2023 19:50:58 -0500 [thread overview]
Message-ID: <Y+7PcqpYhF5ZuApG@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqq5yc1p7yn.fsf@gitster.g>
On Thu, Feb 16, 2023 at 02:21:36PM -0800, Junio C Hamano 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: ...
>
> There has been a discussion on not just "fix mtime" but coming up
> with a lot more stable tar archive format specification.
Yes, I think in brian's proposal the mtime would always be 0. I don't
mind that either (and really, I doubt anybody would really want to set
--mtime to anything but a fixed, known value anyway). This is a much
smaller change that could be done in the meantime with less effort, but
I guess we'd be stuck with --mtime forever, then.
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".
-Peff
next prev parent reply other threads:[~2023-02-17 0:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-16 19:41 Feature request: Add --mtime option to git archive Raul E Rangel
2023-02-16 21:05 ` Jeff King
2023-02-16 22:21 ` Junio C Hamano
2023-02-17 0:50 ` Jeff King [this message]
2023-02-17 2:04 ` Junio C Hamano
2023-02-17 15:43 ` Raul Rangel
2023-02-17 20:31 ` René Scharfe
2023-02-17 20:25 ` Jeff King
2023-02-18 3:04 ` demerphq
2023-02-18 17:08 ` brian m. carlson
2023-02-18 8:36 ` [PATCH] archive: add --mtime René Scharfe
2023-02-18 17:25 ` Junio C Hamano
2023-02-19 10:44 ` René Scharfe
2023-02-21 5:37 ` Junio C Hamano
2023-02-22 19:51 ` Jeff King
2023-02-22 23:23 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+7PcqpYhF5ZuApG@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rrangel@chromium.org \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).