Don't resolve name when it isn't unique

This commit is contained in:
Joscha 2025-05-03 00:45:18 +02:00
parent 9a3004557f
commit 3f2b3d2f73

View file

@ -38,10 +38,18 @@ impl State {
// Otherwise, interpret the identifier as a repo name and find the // Otherwise, interpret the identifier as a repo name and find the
// corresponding id. // corresponding id.
self.repos let matching = self
.repos
.iter() .iter()
.find(|(_, name)| *name == identifier) .filter(|(_, name)| *name == identifier)
.map(|(id, _)| *id) .map(|(id, _)| *id)
.collect::<Vec<_>>();
match matching.first() {
None => None,
Some(_) if matching.len() > 1 => None,
Some(id) => Some(*id),
}
} }
} }