mirror of
https://github.com/cooperspencer/gickup
synced 2024-11-08 12:09:18 +01:00
added force push (#172)
This commit is contained in:
parent
77024fb0a5
commit
082821bfb9
@ -220,11 +220,13 @@ destination:
|
||||
organization: whatever # name of the organization to want to backup to
|
||||
visibility:
|
||||
repositories: private # private, public, default: private
|
||||
force: false # force push to destination
|
||||
onedev:
|
||||
- token: some-token
|
||||
# token_file: token.txt # alternatively, specify token in a file
|
||||
url: http(s)://url-to-onedev
|
||||
organization: whatever # name of the parent project you want to backup to
|
||||
force: false # force push to destination
|
||||
sourcehut:
|
||||
- token: some-token # as of now only the legacy api works, use the legacy token
|
||||
# token_file: token.txt # alternatively, specify token in a file
|
||||
@ -233,6 +235,7 @@ destination:
|
||||
url: http(s)://url-to-sourcehut # if empty, it uses https://git.sr.ht
|
||||
visibility:
|
||||
repositories: private # public, unlisted, private, default: public
|
||||
force: false # force push to destination
|
||||
local:
|
||||
# Export this path from Docker with a volume to make it accessible and more permanent.
|
||||
- path: /some/path/gickup
|
||||
|
@ -494,11 +494,11 @@ func CreateRemotePush(repo *git.Repository, destination types.GenRepo, url strin
|
||||
|
||||
headref, _ := repo.Head()
|
||||
|
||||
pushoptions := git.PushOptions{Auth: auth, RemoteName: remote.Config().Name, RefSpecs: []config.RefSpec{config.RefSpec(fmt.Sprintf("%s:%s", headref.Name(), headref.Name()))}}
|
||||
pushoptions := git.PushOptions{Force: destination.Force, Auth: auth, RemoteName: remote.Config().Name, RefSpecs: []config.RefSpec{config.RefSpec(fmt.Sprintf("%s:%s", headref.Name(), headref.Name()))}}
|
||||
|
||||
err = repo.Push(&pushoptions)
|
||||
if err == nil || err == git.NoErrAlreadyUpToDate {
|
||||
pushoptions = git.PushOptions{Auth: auth, RemoteName: remote.Config().Name, RefSpecs: []config.RefSpec{"refs/heads/*:refs/heads/*", "refs/tags/*:refs/tags/*"}}
|
||||
pushoptions = git.PushOptions{Force: destination.Force, Auth: auth, RemoteName: remote.Config().Name, RefSpecs: []config.RefSpec{"refs/heads/*:refs/heads/*", "refs/tags/*:refs/tags/*"}}
|
||||
|
||||
return repo.Push(&pushoptions)
|
||||
}
|
||||
|
@ -246,6 +246,7 @@ type GenRepo struct {
|
||||
CreateOrg bool `yaml:"createorg"`
|
||||
Visibility Visibility `yaml:"visibility"`
|
||||
Filter Filter `yaml:"filter"`
|
||||
Force bool `yaml:"force"`
|
||||
Contributed bool `yaml:"contributed"`
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user