mirror of
https://github.com/martinvonz/jj.git
synced 2024-10-23 15:00:17 +00:00
cli: find working copy's first parent from commit store (not index)
This avoid another use of `IndexEntry`. The working-copy commit should be in the cache here, so it shouldn't have any impact on performance.
This commit is contained in:
parent
ce5c90b4e5
commit
6c28ec1608
1 changed files with 2 additions and 6 deletions
|
@ -671,12 +671,8 @@ impl WorkspaceCommandHelper {
|
|||
.ok()
|
||||
.map(|commit| commit.id());
|
||||
if let Some(wc_commit_id) = mut_repo.view().get_wc_commit_id(self.workspace_id()) {
|
||||
let first_parent_id = mut_repo
|
||||
.index()
|
||||
.entry_by_id(wc_commit_id)
|
||||
.unwrap()
|
||||
.parents()[0]
|
||||
.commit_id();
|
||||
let wc_commit = mut_repo.store().get_commit(wc_commit_id)?;
|
||||
let first_parent_id = wc_commit.parent_ids()[0].clone();
|
||||
if first_parent_id != *mut_repo.store().root_commit_id() {
|
||||
if let Some(current_git_commit_id) = current_git_commit_id {
|
||||
git_repo.set_head_detached(current_git_commit_id)?;
|
||||
|
|
Loading…
Reference in a new issue