From 5d9007f27b50c17cefecd13ad160840aa4f86ed1 Mon Sep 17 00:00:00 2001 From: Stanislav Seletskiy Date: Tue, 11 Jun 2019 02:33:09 +0300 Subject: add Prune option to PushOptions Signed-off-by: Stanislav Seletskiy --- config/refspec.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'config/refspec.go') diff --git a/config/refspec.go b/config/refspec.go index 391705c..b2b3203 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) } -- cgit