Skip to content

Commit

Permalink
Fix martinvonz#2476, change ids
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Jun 28, 2024
1 parent e21e5e6 commit c0c9441
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/src/id_prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,16 @@ impl IdPrefixContext {
prefix: &HexPrefix,
) -> PrefixResolution<Vec<CommitId>> {
if let Some(indexes) = self.disambiguation_indexes(repo) {
let resolution = indexes.change_index.resolve_prefix_with(
&*indexes.commit_change_ids,
prefix,
|(commit_id, _)| commit_id.clone(),
);
if let PrefixResolution::SingleMatch((_, ids)) = resolution {
return PrefixResolution::SingleMatch(ids);
let resolution: PrefixResolution<(ChangeId, Vec<CommitId>)> = indexes
.change_index
.resolve_prefix_with(&*indexes.commit_change_ids, prefix, |(commit_id, _)| {
commit_id.clone()
});
if let PrefixResolution::SingleMatch((change_id, _ids)) = resolution {
// There may be more commits with this change id outside the narrower sets.
return PrefixResolution::SingleMatch(repo.resolve_change_id(&change_id).expect(
"Change ids present in narrower search set should be present globally.",
));
}
}
repo.resolve_change_id_prefix(prefix)
Expand Down

0 comments on commit c0c9441

Please sign in to comment.