ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib
Martin von Zweigbergk 9e1869dcef working_copy: pass in old commit ID to check_out()
`WorkingCopy::check_out()` currently fails if the commit recorded on
disk has changed since it was last read. It fails with a "concurrent
checkout" error. That usually works well in practice, but one can
imagine cases where it's not correct. For an example where the current
behavior is wrong, consider this sequence of events:

 1. Process A loads the repo and working copy.

 2. Process B loads the repo at operation A. It has not loaded the
    working copy yet.

 3. Process A writes an operation and updates the working copy.

 4. Process B loads the working copy and sees that it is checked out
    to the commit process B set it to. We don't currently have any
    checks that the working copy commit matches the view's checkout
    (though I plan to add that).

 5. Process B finishes its operation (which is now divergent with the
    operation written by process A). It updates the working copy to
    the checkout set in the repo view by process B. There's no data
    loss here, but the behavior is surprising because we would usually
    tell the user that we detected a concurrent update to the working
    copy.

We should instead check that the working copy's commit on disk matches
what the previous repo view said, i.e. the view at the start of the
operation we just committed. This patch does that by having the caller
pass in the expected old commit ID.
2022-01-19 09:04:01 -08:00
..
benches project: rename project from Jujube to Jujutsu 2021-05-15 10:28:40 -07:00
protos git: start tracking HEAD of underlying Git repo 2021-12-01 11:08:53 -08:00
src working_copy: pass in old commit ID to check_out() 2022-01-19 09:04:01 -08:00
tests working_copy: pass in old commit ID to check_out() 2022-01-19 09:04:01 -08:00
build.rs
Cargo.toml cargo: upgrade to Rust 2021 (just to stay up to date) 2021-12-13 21:47:00 -08:00