ref: 79fa8662317d7daebc2f95d729c66fec9f86cdcd
dir: /refstore/packed/shorten.go/
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
}