summaryrefslogtreecommitdiff
path: root/update.go
diff options
context:
space:
mode:
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
+}