next/prev: move current_short variable closer to first use

This commit is contained in:
Martin von Zweigbergk 2024-02-11 21:49:28 -08:00 committed by Martin von Zweigbergk
parent 44e1d4a72d
commit 3b075f1487
2 changed files with 2 additions and 2 deletions

View file

@ -106,7 +106,6 @@ pub(crate) fn cmd_next(
.get_wc_commit_id()
.ok_or_else(|| user_error("This command requires a working copy"))?;
let current_wc = workspace_command.repo().store().get_commit(current_wc_id)?;
let current_short = short_commit_hash(current_wc.id());
// If we're editing, start at the working-copy commit.
// Otherwise start from our direct parent.
let start_id = if edit {
@ -140,6 +139,7 @@ pub(crate) fn cmd_next(
}
commits => choose_commit(ui, &workspace_command, "next", commits)?,
};
let current_short = short_commit_hash(current_wc.id());
let target_short = short_commit_hash(target.id());
// We're editing, just move to the target commit.
if edit {

View file

@ -69,7 +69,6 @@ pub(crate) fn cmd_prev(
.get_wc_commit_id()
.ok_or_else(|| user_error("This command requires a working copy"))?;
let current_wc = workspace_command.repo().store().get_commit(current_wc_id)?;
let current_short = short_commit_hash(current_wc.id());
let start_id = if edit {
current_wc_id
} else {
@ -106,6 +105,7 @@ pub(crate) fn cmd_prev(
commits => choose_commit(ui, &workspace_command, "prev", commits)?,
};
// Generate a short commit hash, to make it readable in the op log.
let current_short = short_commit_hash(current_wc.id());
let target_short = short_commit_hash(target.id());
// If we're editing, just move to the revision directly.
if edit {