Git handling of commit times
emaste at freebsd.org
Thu May 30 13:34:32 UTC 2019
On Wed, 29 May 2019 at 22:34, Grzegorz Junka <list1 at gjunka.com> wrote:
> The time when the commit is made is not related to when it's pushed to
> the remote. I am saying that for this to work the hook on your laptop
> would need to check the time on the server when the commit is being made
> locally (e.g. on a train).
Yes, the commit time is not related to when it's pushed. But you still
don't need any external access at the time of commit; perhaps I've
been unclear about requirements. The goal here is to ensure that
timestamp ordering matches commit DAG ordering, not that the
timestamps are "correct" for some definition thereof.
Let me try to clarify the two example cases:
> The commit could be made, say, with tomorrow's date, but pushed to the
> remote next week.
That case is fine - if you have a post-dated commit that's not yet
part of the canonical tree there's no issue; it's not possible for
someone else to create another commit as a child of yours. The
discussion here is about the view of commit dates in the canonical
repository and a potential commit hook to enforce rules on those; it
does not matter at all what's in a private repo.
> Equally, the commit could be made
> with yesterday's date and if HEAD is a week ago this again wouldn't be
That's fine too - as long as the commit is after its parents it's fine.
More information about the freebsd-git