aboutsummaryrefslogtreecommitdiffstats
path: root/internal/reference
diff options
context:
space:
mode:
Diffstat (limited to 'internal/reference')
-rw-r--r--internal/reference/sort.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/reference/sort.go b/internal/reference/sort.go
new file mode 100644
index 0000000..726edbd
--- /dev/null
+++ b/internal/reference/sort.go
@@ -0,0 +1,14 @@
+package reference
+
+import (
+ "sort"
+
+ "github.com/go-git/go-git/v5/plumbing"
+)
+
+// Sort sorts the references by name to ensure a consistent order.
+func Sort(refs []*plumbing.Reference) {
+ sort.Slice(refs, func(i, j int) bool {
+ return refs[i].Name() < refs[j].Name()
+ })
+}