ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: remove early return after merging operations

This simplifies the control flow by having only one return (plus the
implicit ones from `?`).
This commit is contained in:
Martin von Zweigbergk 2022-10-07 23:47:37 -07:00 committed by Martin von Zweigbergk
parent 94501131ac
commit b4dc105dd7

View file

@ -234,8 +234,11 @@ jj init --git-repo=.";
repo_loader.op_heads_store(),
&self.global_args.at_operation,
)?;
let repo = match op_heads {
OpHeads::Single(op) => repo_loader.load_at(&op),
let mut workspace_command = match op_heads {
OpHeads::Single(op) => {
let repo = repo_loader.load_at(&op);
self.for_loaded_repo(ui, workspace, repo)?
}
OpHeads::Unresolved {
locked_op_heads,
op_heads,
@ -263,11 +266,9 @@ jj init --git-repo=.";
let merged_repo = tx.write().leave_unpublished();
locked_op_heads.finish(merged_repo.operation());
workspace_command.repo = merged_repo;
workspace_command.snapshot(ui)?;
return Ok(workspace_command);
workspace_command
}
};
let mut workspace_command = self.for_loaded_repo(ui, workspace, repo)?;
workspace_command.snapshot(ui)?;
Ok(workspace_command)
}