blob: 493b54227c0efe32da3bb85f9b9f9d977e34fa9d (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package packed
import "codeberg.org/lindenii/furgit/refstore"
// Shorten returns the shortest unambiguous shorthand for a packed ref name.
func (store *Store) Shorten(name string) (string, error) {
_, ok := store.byName[name]
if !ok {
return "", refstore.ErrReferenceNotFound
}
names := make([]string, 0, len(store.ordered))
for _, entry := range store.ordered {
names = append(names, entry.Name())
}
return refstore.ShortenName(name, names), nil
}
|