summaryrefslogtreecommitdiff
path: root/refs.sort.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-26 05:34:26 -0600
committerJeff Carr <[email protected]>2024-11-26 05:34:26 -0600
commit44caec2e7fc59697ef01835aacf8a03171a42bea (patch)
tree33bbb0ff3200d5a49eb6aa407ea1bd5f0fa828bd /refs.sort.go
parentf7bf89148d1c66505dc102f0e27f62371f5004f4 (diff)
take a stab at a protobuf for the go deps
Diffstat (limited to 'refs.sort.go')
-rw-r--r--refs.sort.go41
1 files changed, 5 insertions, 36 deletions
diff --git a/refs.sort.go b/refs.sort.go
index 8d8a9ea..94d3124 100644
--- a/refs.sort.go
+++ b/refs.sort.go
@@ -65,7 +65,7 @@ func (r *Refs) All() *RefIterator {
func (r *Refs) SortByName() *RefIterator {
packs := r.selectAllRefs()
- sort.Sort(ByName(packs))
+ sort.Sort(RefsByName(packs))
iterator := NewRefIterator(packs)
return iterator
@@ -113,11 +113,11 @@ func (r *Refs) Len() int {
return len(r.Refs)
}
-type ByName []*Ref
+type RefsByName []*Ref
-func (a ByName) Len() int { return len(a) }
-func (a ByName) Less(i, j int) bool { return a[i].RefName < a[j].RefName }
-func (a ByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+func (a RefsByName) Len() int { return len(a) }
+func (a RefsByName) Less(i, j int) bool { return a[i].RefName < a[j].RefName }
+func (a RefsByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
// safely returns a slice of pointers to the Ref protobufs
func (r *Refs) selectAllRefs() []*Ref {
@@ -147,34 +147,3 @@ func (all *Refs) DeleteByHash(hash string) *Ref {
}
return nil
}
-
-/*
-func (r *Refs) UnmergedRefRepos() *RefRepoIterator {
- repoPointers := r.selectUnmergedRefRepos()
-
- sort.Sort(ByName(repoPointers))
-
- iterator := NewRefRepoIterator(repoPointers)
-
- return iterator
-}
-*/
-
-/*
-// this sort doesn't really work. I think it forgets to sort the last two
-// todo: sort this out. literally
-// SelectRefPointers safely returns a slice of pointers to Ref records.
-func (r *Refs) selectUnmergedRefs() []*RefRow {
- r.RLock()
- defer r.RUnlock()
-
- // Create a new slice to hold pointers to each Ref
- // repoPointers := make([]*Ref, len(c.E.Refs))
- var repoPointers []*RefRow
- for _, repo := range me.allrepos {
- repoPointers = append(repoPointers, repo) // Copy pointers for safe iteration
- }
-
- return repoPointers
-}
-*/