Git handling of commit times

Xin Li delphij at delphij.net
Thu May 30 06:48:36 UTC 2019


On 5/29/19 10:08, Ed Maste wrote:
> On Wed, 29 May 2019 at 11:40, Grzegorz Junka <list1 at gjunka.com> wrote:
>>
>> Timestamp alone doesn't give much information. What matters is when the
>> branch in which the commit was added has been merged with other branches
>> (shown as merge commits in the history).
> 
> Our history is mostly devoid of merges though, but your broader point
> is certainly valid - the relationship that's actually important is the
> parent/child commits, not the order of either date stamp.
> 
>> Bear in mind that commits are local (by the virtue of git being
>> distributed scm). You can certainly write a git hook that verifies local
>> time to be approximately the same as server time and stop the commit if
>> that's not the case. But that's clunky and patronizing in my opinion\
>> (e.g. someone won't be able to commit when on a train and off the grid).
> 
> I'm not suggesting that we require the commit time to be close to the
> server time, just that we could disallow two actually invalid cases:
> 
> - commit time is earlier than parent(s)
> - commit time is later than the (accurate) server time
> 
> If you have local commits made while on the train and someone else
> pushes to the canonical repository before you're back online you're
> going to have to merge or rebase, and will then have an updated commit
> time.
> 
> The solution to this issue triggering is easy - just make sure the
> client has the correct time.

Or, have the server perform the required operation (a merge, or a
rebase) on behalf of the user, based on CI result, etc.

>> Git commits are joined by hashes, timestamp is only some metadata. It
>> makes sens to talk about amount of commits since a particular hash but
>> not so much about amount of commits since a particular date.
> 
> Indeed, but that said developers like to think in terms like "commits
> since a particular date", and we should provide a good experience
> there if we can do so without restricting realistic workflows.

Assuming the dates are trustworthy (e.g. the merge or rebase was
performed by the server), that can be accomplished with e.g. git log
--since.  Practically, I think it's more useful to do e.g. git log
release/11.1..HEAD and I'm not particularly worried if the dates were
not that accurate.

Cheers,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-git/attachments/20190529/7d572966/attachment.sig>


More information about the freebsd-git mailing list