summaryrefslogtreecommitdiff
path: root/update.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-26 04:34:01 -0600
committerJeff Carr <[email protected]>2024-11-26 04:34:01 -0600
commit316bc8ea81200a48b8a7259905720362b512ce2a (patch)
tree411251bf71593f7e434f92cd0124108dafe365c6 /update.go
Day 1
Diffstat (limited to 'update.go')
-rw-r--r--update.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/update.go b/update.go
new file mode 100644
index 0000000..c530c01
--- /dev/null
+++ b/update.go
@@ -0,0 +1,24 @@
+package gitpb
+
+// this is becoming a standard format
+// todo: autogenerate this from the .proto file?
+
+// Update version and timestamp.
+// returns ok (ok == true if not found)
+func (r *Refs) Update(newP *Ref) bool {
+ lock.Lock()
+ defer lock.Unlock()
+
+ var found *Ref
+ for _, p := range r.Refs {
+ if p.RefName == newP.RefName {
+ found = p
+ }
+ }
+ if found == nil {
+ // r.Append(newP) // update here?
+ return true
+ }
+
+ return true
+}