aboutsummaryrefslogtreecommitdiffstats
path: root/remote.go
diff options
context:
space:
mode:
authorkappyhappy <t.katsu1031@gmail.com>2020-05-21 10:36:31 +0900
committerkappyhappy <t.katsu1031@gmail.com>2020-05-21 18:12:48 +0900
commitb5b511a94e28ea0346fc83a2afec43e5514fdb1e (patch)
tree300780aa8d799bef9ac7c85618e514f07bb72516 /remote.go
parent838eb2979f6085fc0e5bc8856e7f1944a455a970 (diff)
downloadgo-git-b5b511a94e28ea0346fc83a2afec43e5514fdb1e.tar.gz
Remote.Push: support force option
Diffstat (limited to 'remote.go')
-rw-r--r--remote.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/remote.go b/remote.go
index 98c4acf..e642c57 100644
--- a/remote.go
+++ b/remote.go
@@ -123,6 +123,15 @@ func (r *Remote) PushContext(ctx context.Context, o *PushOptions) (err error) {
return ErrDeleteRefNotSupported
}
+ if o.Force {
+ for i := 0; i < len(o.RefSpecs); i++ {
+ rs := &o.RefSpecs[i]
+ if !rs.IsForceUpdate() {
+ o.RefSpecs[i] = config.RefSpec("+" + rs.String())
+ }
+ }
+ }
+
localRefs, err := r.references()
if err != nil {
return err