last_modified: don't find_blob; find the commit! #10
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-last_modified"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
To get the last_modified timestamp we need the commit object not the blob. This is closer to the old behavior, and will return a correct timestamp on an existing file outside change_and_push like before.
@ -486,4 +466,0 @@
~some:Fun.id (Ptime.of_float_s (Int64.to_float secs))
in
Ok ts
| _ ->
We ended up here due to
find_blob
returning aBlob _
and not aCommit _
(how surprising given the name!)should the same be applied to
digest
-- where !6 and !8 introduced theval commit
since we ended up in https://github.com/robur-coop/git-kv/issues/6...Hm. To me it seems fine that
digest
returns the blob. As I understand it it's a digest that represents the file data. Maybe @dinosaure, who has a much better understanding of both git and ocaml-git, has an opinion?What
digest
should return is a unique hash of the data. This can be achieved by the last commit sha1. This can as well be done by computing a hash of the content.Here, it is nowadays computed by the commit if we're not in change_and_push, and by this Blob thingy if we're in change_and_push. Of course we can leave that as is -- but I think that having a divergence in what the digest is computed over depending on whether we're in change_and_push or not may lead to unexpected strange error situations.
But this is off-topic to the PR you propose here...
@ -493,0 +491,4 @@
~some:Fun.id (Ptime.of_float_s (Int64.to_float secs))
in
Ok ts
| _ -> assert false
this case shouldn't be needed
What do you suggest instead? Mute partial match warnings?
yes, as done in
let pull
This is done in
d2a0e526da
. I found that there's no support for infix attributes on binding operators (.e.glet+
) so I went with an intermediate binding.https://github.com/ocaml/ocaml/issues/9301
LGTM