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 workspace: move search for .jj/ directory from Repo to Workspace 2021-11-25 21:08:43 -08:00
test_commit_builder.rs transaction: remove Drop implementation 2021-12-01 10:31:35 -08:00
test_commit_concurrent.rs workspace: move search for .jj/ directory from Repo to Workspace 2021-11-25 21:08:43 -08:00
test_conflicts.rs tests: extract variable for store in test_conflicts 2021-11-25 21:04:56 -08:00
test_diff_summary.rs testutils: make init_repo return a struct, including a Workspace 2021-11-25 21:04:56 -08:00
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 transaction: remove Drop implementation 2021-12-01 10:31:35 -08:00
test_init.rs transaction: remove Drop implementation 2021-12-01 10:31:35 -08:00
test_load_repo.rs workspace: move search for .jj/ directory from Repo to Workspace 2021-11-25 21:08:43 -08:00
test_merge_trees.rs testutils: make init_repo return a struct, including a Workspace 2021-11-25 21:04:56 -08:00
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 testutils: make init_repo return a struct, including a Workspace 2021-11-25 21:04:56 -08:00
test_refs.rs testutils: make init_repo return a struct, including a Workspace 2021-11-25 21:04:56 -08:00
test_revset_graph_iterator.rs testutils: make init_repo return a struct, including a Workspace 2021-11-25 21:04:56 -08:00
test_revset.rs revsets: add author() and committer() functions (#46) 2021-12-15 22:50:29 -08:00
test_rewrite.rs transaction: remove Drop implementation 2021-12-01 10:31:35 -08:00
test_view.rs testutils: make init_repo return a struct, including a Workspace 2021-11-25 21:04:56 -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_working_copy.rs working_copy: pass in old commit ID to check_out() 2022-01-19 09:04:01 -08:00
test_workspace.rs workspace: move search for .jj/ directory from Repo to Workspace 2021-11-25 21:08:43 -08:00