Git development
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Yashwanth Sai via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Yashwanth Sai <ysaimuppineni789@gmail.com>
Subject: Re: [PATCH/RFC] commit: warn when a new commit is dated before its parent
Date: Sat, 19 Sep 2026 15:01:48 +0000	[thread overview]
Message-ID: <aq6j2yg16L2iNHoR@fruit.crustytoothpaste.net> (raw)
In-Reply-To: <pull.2226.git.1789826665188.gitgitgadget@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2082 bytes --]

On 2026-09-19 at 14:04:25, Yashwanth Sai via GitGitGadget wrote:
> From: Yashwanth Sai <ysaimuppineni789@gmail.com>
> 
> Git writes whatever the clock says into the commit object and validates
> nothing: a commit dated years in the future, or earlier than its own
> parent, is accepted silently. "git fsck --strict" does not object either,
> since fsck's badDate and badDateOverflow checks are purely syntactic.
> 
> That would be harmless if history traversal did not assume commit dates
> are non-decreasing, but it does. "git log --since" stops walking at the
> first commit older than the cutoff, so a single out-of-order date hides
> every commit behind it:
> 
> 	$ git log --pretty='%cd %s' --date=short
> 	2026-09-25 C3 - inside the window
> 	2026-09-01 C2 - outside the window
> 	2026-09-20 C1 - inside the window
> 
> 	$ git log --pretty='%cd %s' --date=short --since=2026-09-13
> 	2026-09-25 C3 - inside the window
> 
> C1 is inside the window and silently missing. This is understood --
> 96697781e0 (revision: add "--since-as-filter" option, 2022-07-19) added
> an opt-in traversal mode for it -- but nothing tells the person whose
> clock caused it, at the moment they could still fix it cheaply.
> 
> Warn at commit time when the new commit's date precedes a parent's, gated
> on a new advice.clockSkew setting. Warning rather than refusing is
> deliberate: only the committer can tell whether their clock or the
> parent's is the wrong one. Once the commit is published the date is part
> of its object name, and correcting it means rewriting every descendant,
> so the warning is worth little later and quite a lot now.

I think such a change is useful and it certainly has been discussed on
the list quite a bit.

> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

I don't think this is allowed by the `ai` section of
`Documentation/SubmittingPatches`. I wouldn't be opposed to seeing such
a patch if it were not produced in any way by AI, though.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 325 bytes --]

  reply	other threads:[~2026-09-19 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 14:04 [PATCH/RFC] commit: warn when a new commit is dated before its parent Yashwanth Sai via GitGitGadget
2026-09-19 15:01 ` brian m. carlson [this message]
2026-09-19 15:46   ` Yashwanth Sai

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aq6j2yg16L2iNHoR@fruit.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=ysaimuppineni789@gmail.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox