ok/jj
1
0
Fork 0
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:
Yuya Nishihara 2022-07-07 17:43:42 +09:00 committed by Martin von Zweigbergk
parent 7c90f9e18d
commit 4f8583c7d2

View file

@ -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 \