mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-31 16:33:10 +00:00
cli: when untracking paths, get old commit id while under lock
Before this patch, we got the old commit ID before we took the lock on the working copy, which means we might unnecessarily create divergence if another process just committed the working copy.
This commit is contained in:
parent
ed9c23281b
commit
91c8c27cc5
1 changed files with 1 additions and 1 deletions
|
@ -1583,12 +1583,12 @@ fn cmd_untrack(
|
|||
args.values_of("paths"),
|
||||
)?;
|
||||
let mut tx = workspace_command.start_transaction("untrack paths");
|
||||
let old_commit = workspace_command.working_copy_mut().current_commit();
|
||||
let unfinished_write = workspace_command
|
||||
.working_copy_mut()
|
||||
.untrack(matcher.as_ref())
|
||||
.map_err(|err| CommandError::InternalError(format!("Failed to untrack paths: {}", err)))?;
|
||||
let new_tree_id = unfinished_write.new_tree_id();
|
||||
let old_commit = unfinished_write.old_commit();
|
||||
let new_commit = CommitBuilder::for_rewrite_from(ui.settings(), &store, &old_commit)
|
||||
.set_tree(new_tree_id)
|
||||
.write_to_repo(tx.mut_repo());
|
||||
|
|
Loading…
Reference in a new issue