diff options
| author | Carlos Martín Nieto <[email protected]> | 2014-05-25 09:06:18 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <[email protected]> | 2014-05-25 09:12:10 +0200 |
| commit | 2942e18d056d725aa847d77492a75391a670de5f (patch) | |
| tree | 56f80569a13584c33731cd2b51bfa363b7a89218 /reference.go | |
| parent | ec97cb4473ead2d9111ba4a519f3eb87eb7fdc4f (diff) | |
Give Object and Reference an Onwer accessor
This reduces the need to carry around a pointer to the repository as
well as the objects.
Diffstat (limited to 'reference.go')
| -rw-r--r-- | reference.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/reference.go b/reference.go index 8c8b282..9a2a8e5 100644 --- a/reference.go +++ b/reference.go @@ -161,6 +161,14 @@ func (v *Reference) Peel(t ObjectType) (Object, error) { return allocObject(cobj), nil } +// Owner returns a weak reference to the repository which owns this +// reference. +func (v *Reference) Owner() *Repository { + return &Repository{ + ptr: C.git_reference_owner(v.ptr), + } +} + // Cmp compares both references, retursn 0 on equality, otherwise a // stable sorting. func (v *Reference) Cmp(ref2 *Reference) int { |
