ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib/tests
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
..
test_bad_locking.rs
test_commit_builder.rs
test_commit_concurrent.rs
test_conflicts.rs
test_diff_summary.rs
test_git.rs git: on import, only add ref target as head if target changed (#44) 2021-12-11 11:03:40 -08:00
test_index.rs
test_init.rs
test_load_repo.rs
test_merge_trees.rs
test_mut_repo.rs repo: don't use stale view when checking for changes 2021-12-05 22:01:48 -08:00
test_operations.rs
test_refs.rs
test_revset.rs revsets: add author() and committer() functions (#46) 2021-12-15 22:50:29 -08:00
test_revset_graph_iterator.rs
test_rewrite.rs
test_view.rs
test_working_copy.rs working_copy: pass in old commit ID to check_out() 2022-01-19 09:04:01 -08:00
test_working_copy_concurrent.rs working_copy: pass in old commit ID to check_out() 2022-01-19 09:04:01 -08:00
test_workspace.rs