diff --git a/lib/src/id_prefix.rs b/lib/src/id_prefix.rs index f3a47e706d..766cbd502d 100644 --- a/lib/src/id_prefix.rs +++ b/lib/src/id_prefix.rs @@ -168,13 +168,16 @@ impl IdPrefixContext { prefix: &HexPrefix, ) -> PrefixResolution> { 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)> = 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)