mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-31 00:12:06 +00:00
next/prev: move current_short
variable closer to first use
This commit is contained in:
parent
44e1d4a72d
commit
3b075f1487
2 changed files with 2 additions and 2 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue