Web lists-archives.com

Re: Finer timestamps and serialization in git

On 16/05/2019 00:40, Eric S. Raymond wrote:
Jason Pyeron <jpyeron@xxxxxxxx>:
If we take the below example:

committer Name <user@domain> 1557948240 -0400

and we follow the rule that:

1. any trailing zero after the decimal point MUST be omitted
2. if there are no digits after the decimal point, it MUST be omitted

This would allow:

committer Name <user@domain> 1557948240 -0400
committer Name <user@domain> 1557948240.12 -0400

but the following are never allowed:

committer Name <user@domain> 1557948240. -0400
committer Name <user@domain> 1557948240.000000 -0400

By following these rules, all previous commits' hash are unchanged. Future commits made on the top of the second will look like old commit formats. Commits coming from "older" tools will produce valid and mergeable objects. The loss precision has frustrated us several times as well.
Yes, that's almost exactly what I came up with.  I was concerned with upward
compatibility in fast-export streams, which reposurgeon ingests and emits.

But I don't quite understand your claim that there's no format
breakage here, unless you're implying to me that timestamps are already
stored in the git file system as variable-length strings.  Do they
really never get translated into time_t?  Good news if so.
Maybe just take some of the object ID bits as being the fractional time timestamp. They are effectively random, so should do a reasonable job of distinguishing commits in a repeatable manner, even with full round tripping via older git versions (as long as the sha1 replicates...)

As I understand it the commit timestamp is actually free text within the commit object (try `git cat-file -p <commit_object>), so the issue is whether the particular git version is ready to accept the additional 'dot' factional time notation (future versions could be extended, but I think old ones would reject them if I understand the test up thread - which would compromise backward compatibility and round tripping).