diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2019-07-26 18:59:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-26 18:59:37 +0200 |
commit | 1edb992dbc419a0767b1cf3a524b0d35529799f5 (patch) | |
tree | fe994302589318133ec34e74bfe8c8f302a5147d /config/refspec.go | |
parent | 4a6d836e2fa35fd05d2bfeeaecbb546c2e10ece1 (diff) | |
parent | 17ea92a0703c21b744560e6586ee61431dba9ffb (diff) | |
download | go-git-1edb992dbc419a0767b1cf3a524b0d35529799f5.tar.gz |
Merge pull request #1165 from seletskiy/push-prune
Remote: add Prune option to PushOptions
Diffstat (limited to 'config/refspec.go')
-rw-r--r-- | config/refspec.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/config/refspec.go b/config/refspec.go index d32a2e4..14bb400 100644 --- a/config/refspec.go +++ b/config/refspec.go @@ -127,6 +127,13 @@ func (s RefSpec) Dst(n plumbing.ReferenceName) plumbing.ReferenceName { return plumbing.ReferenceName(dst[0:wd] + match + dst[wd+1:]) } +func (s RefSpec) Reverse() RefSpec { + spec := string(s) + separator := strings.Index(spec, refSpecSeparator) + + return RefSpec(spec[separator+1:] + refSpecSeparator + spec[:separator]) +} + func (s RefSpec) String() string { return string(s) } |