Skip to content

Commit

Permalink
cli: commit: set up rewritten commit early
Browse files Browse the repository at this point in the history
For the same reason as the previous commit.
  • Loading branch information
yuja committed Jul 24, 2024
1 parent 453e4f3 commit 7d50ebc
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions cli/src/commands/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ new working-copy commit.
)?;
}

let mut commit_builder = tx
.mut_repo()
.rewrite_commit(command.settings(), &commit)
.detach();
commit_builder.set_tree_id(tree_id);
if args.reset_author {
commit_builder.set_author(commit_builder.committer().clone());
}

let template = description_template_for_commit(
ui,
command.settings(),
Expand All @@ -113,17 +122,9 @@ new working-copy commit.
} else {
edit_description(tx.base_repo(), &template, command.settings())?
};
commit_builder.set_description(description);
let new_commit = commit_builder.write(tx.mut_repo())?;

let mut commit_builder = tx
.mut_repo()
.rewrite_commit(command.settings(), &commit)
.set_tree_id(tree_id)
.set_description(description);
if args.reset_author {
let new_author = commit_builder.committer().clone();
commit_builder = commit_builder.set_author(new_author);
}
let new_commit = commit_builder.write()?;
let workspace_ids = tx
.mut_repo()
.view()
Expand Down

0 comments on commit 7d50ebc

Please sign in to comment.