mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-07 04:51:45 +00:00
git: exclude hidden commits from list of commits to be abandoned
This wasn't a problem before, but we wouldn't want to report previously-hidden commits as abandoned.
This commit is contained in:
parent
16d3bcd4c5
commit
65ecac10e9
1 changed files with 8 additions and 2 deletions
|
@ -29,7 +29,7 @@ use crate::backend::{BackendError, CommitId, ObjectId};
|
|||
use crate::git_backend::GitBackend;
|
||||
use crate::op_store::{BranchTarget, RefTarget, RefTargetOptionExt};
|
||||
use crate::repo::{MutableRepo, Repo};
|
||||
use crate::revset;
|
||||
use crate::revset::{self, RevsetExpression};
|
||||
use crate::settings::GitSettings;
|
||||
use crate::view::{RefName, View};
|
||||
|
||||
|
@ -308,7 +308,13 @@ pub fn import_some_refs(
|
|||
// about abandoned commits for now. We may want to change this if we ever
|
||||
// add a way of preserving change IDs across rewrites by `git` (e.g. by
|
||||
// putting them in the commit message).
|
||||
let abandoned_commits = revset::walk_revs(mut_repo, &hidable_git_heads, &pinned_heads)
|
||||
let abandoned_expression = RevsetExpression::commits(pinned_heads)
|
||||
.range(&RevsetExpression::commits(hidable_git_heads))
|
||||
.intersection(&RevsetExpression::visible_heads().ancestors());
|
||||
let abandoned_commits = revset::optimize(abandoned_expression)
|
||||
.resolve(mut_repo)
|
||||
.unwrap()
|
||||
.evaluate(mut_repo)
|
||||
.unwrap()
|
||||
.iter()
|
||||
.collect_vec();
|
||||
|
|
Loading…
Reference in a new issue