summaryrefslogtreecommitdiff
path: root/update.go
blob: c530c019ee4ecbf232c91d242da426087a282bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
}