diff options
author | kappyhappy <t.katsu1031@gmail.com> | 2020-05-21 10:36:31 +0900 |
---|---|---|
committer | kappyhappy <t.katsu1031@gmail.com> | 2020-05-21 18:12:48 +0900 |
commit | b5b511a94e28ea0346fc83a2afec43e5514fdb1e (patch) | |
tree | 300780aa8d799bef9ac7c85618e514f07bb72516 /remote.go | |
parent | 838eb2979f6085fc0e5bc8856e7f1944a455a970 (diff) | |
download | go-git-b5b511a94e28ea0346fc83a2afec43e5514fdb1e.tar.gz |
Remote.Push: support force option
Diffstat (limited to 'remote.go')
-rw-r--r-- | remote.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 |