mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-27 06:27:43 +00:00
transaction: don't walk to root when adding on top of non-head
I don't know why I made the walk stop at heads instead of indexed commits before. Perhaps I did it because it's cheap to check in the set of head. However, it gets very expensive to walk all the way back to the root if the parents are not in the set of heads.
This commit is contained in:
parent
0f56e014b7
commit
37cf6a8395
1 changed files with 2 additions and 1 deletions
|
@ -145,6 +145,7 @@ impl<'r> Transaction<'r> {
|
|||
mut_repo.view_mut().add_head(head);
|
||||
mut_repo.evolution_mut().add_commit(head);
|
||||
} else {
|
||||
let index = mut_repo.index();
|
||||
let missing_commits = topo_order_reverse(
|
||||
vec![head.clone()],
|
||||
Box::new(|commit: &Commit| commit.id().clone()),
|
||||
|
@ -152,7 +153,7 @@ impl<'r> Transaction<'r> {
|
|||
commit
|
||||
.parents()
|
||||
.into_iter()
|
||||
.filter(|parent| !current_heads.contains(parent.id()))
|
||||
.filter(|parent| !index.has_id(parent.id()))
|
||||
.collect()
|
||||
}),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue