aboutsummaryrefslogtreecommitdiffstats
path: root/entity/refs.go
diff options
context:
space:
mode:
authorvince <vincetiu8@gmail.com>2020-11-19 20:57:57 +0800
committerMichael Muré <batolettre@gmail.com>2020-11-22 15:20:51 +0100
commit647b05eee4b612f33a2f22576821ea1c012d7c84 (patch)
tree8e9e7d95f1238678e528d9a302936107a0766de7 /entity/refs.go
parent25b0c71948fe4bf5b4f4b8ca91ffc4d2f8c47643 (diff)
downloadgit-bug-647b05eee4b612f33a2f22576821ea1c012d7c84.tar.gz
add remove identity feature
also adds: - listlocalidentities - refactors refstoids into entity package
Diffstat (limited to 'entity/refs.go')
-rw-r--r--entity/refs.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/entity/refs.go b/entity/refs.go
new file mode 100644
index 00000000..82b1741b
--- /dev/null
+++ b/entity/refs.go
@@ -0,0 +1,18 @@
+package entity
+
+import "strings"
+
+func RefsToIds(refs []string) []Id {
+ ids := make([]Id, len(refs))
+
+ for i, ref := range refs {
+ ids[i] = refToId(ref)
+ }
+
+ return ids
+}
+
+func refToId(ref string) Id {
+ split := strings.Split(ref, "/")
+ return Id(split[len(split)-1])
+}