only use a single commit in rename #3
Loading…
Reference in a new issue
No description provided.
Delete branch "rename-single-commit"
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?
best applied after #2 -- then the
t.committed
is the indication whether we're in achange_and_push
or not.@ -717,0 +719,4 @@
| Some _ -> op t
| None ->
change_and_push t op >>! function
| Ok a -> Lwt.return a
should this be
| Ok _ as a -> Lwt.return a
?no, we need to unpack the inner result -- which is a (unit, _) result.
@ -649,4 +649,2 @@
remove ?and_commit:t.committed t key >|= Result.map_error to_write_error
let rename t ~source ~dest =
(* TODO(dinosaure): optimize it! It was done on the naive way. *)
Should we keep this comment?
we can. I'm not sure what we should do with the comment, to be honest.
I opened an issue on GitHub instead: https://github.com/robur-coop/git-kv/issues/4
@ -717,0 +716,4 @@
set t dest contents
in
match t.committed with
| Some _ -> op t
I thought "why not unconditionally do
change_and_push
?" and the answer is we disallow nestedchange_and_push
and this is how we check if we're inside achange_and_push
.Now I am curious if we don't have any yield points inside
op
?Likely deserves a comment about why we check committed.
I may be slow - what do you mean by "don't have any yield points inside
op
"? We do have various yield points in there...added a comment in
708cd7d
So my worry was that we could have an unfortunate task interleaving where
rename
just read/foo
then another task (also insidechange_and_push
) sets/foo
to something else and then the first task continues with remove & set. This was a problem before and this is an improvement.that scenario shouldn't appear anymore, since we're always in a change_and_push now.
Well, it can appear if both tasks are within the
change_and_push
:eab5511ab7
to708cd7d008
rebased on main