forked from mirrors/jj
cli: handle check out error of stale working copy gracefully
If "jj checkout" failed because of conflicting files, the subsequent command would also fail. Let's make it at least not panic.
This commit is contained in:
parent
7c90f9e18d
commit
4f8583c7d2
1 changed files with 9 additions and 1 deletions
|
@ -627,7 +627,15 @@ impl WorkspaceCommandHelper {
|
|||
wc_operation.id().hex(),
|
||||
repo_operation.id().hex()
|
||||
)?;
|
||||
locked_wc.check_out(&checkout_commit.tree()).unwrap();
|
||||
locked_wc
|
||||
.check_out(&checkout_commit.tree())
|
||||
.map_err(|err| {
|
||||
CommandError::InternalError(format!(
|
||||
"Failed to check out commit {}: {}",
|
||||
checkout_commit.id().hex(),
|
||||
err
|
||||
))
|
||||
})?;
|
||||
} else {
|
||||
return Err(CommandError::InternalError(format!(
|
||||
"The repo was loaded at operation {}, which seems to be a sibling of the \
|
||||
|
|
Loading…
Reference in a new issue