func entryKey(entry *objects.TreeEntry, usingMode bool) string { key := entry.ObjectId().String() + entry.Name() if usingMode { key = fmt.Sprintf("%s%d", key, uint16(entry.Mode())) } return key }
func flatten(r api.Repository, base string, treeEntry *objects.TreeEntry) (result []*objects.TreeEntry, err error) { result = make([]*objects.TreeEntry, 0) var object objects.Object object, err = r.ObjectFromOid(treeEntry.ObjectId()) if err != nil { return nil, err } tree, _ := object.(*objects.Tree) for _, entry := range tree.Entries() { result = append(result, objects.NewTreeEntry(entry.Mode(), entry.ObjectType(), base+entry.Name(), entry.ObjectId())) } return result, nil }
func compare(a, b *objects.TreeEntry) order { if a == b { return Same } if a == nil { return Less } if b == nil { return More } aId, bId := a.ObjectId().String(), b.ObjectId().String() if aId < bId { return Less } if aId > bId { return More } return Same }