diff options
author | Nathan Bell <nbell@lucidchart.com> | 2020-11-23 12:04:15 -0700 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-11-25 08:41:22 +1100 |
commit | c4cce584643776b06ac1b525e207bb25bcdf3241 (patch) | |
tree | 745e2b82174e078dddfe49dc20405f01da1faa27 /pkg/commands/sync.go | |
parent | f7e6d4e7248293dc1a70a2c616d8a5334dee07f8 (diff) |
Allow --follow-tags to be disabled if push.followTags is configured to false
Diffstat (limited to 'pkg/commands/sync.go')
-rw-r--r-- | pkg/commands/sync.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/pkg/commands/sync.go b/pkg/commands/sync.go index 96d0480b4..8ebea010b 100644 --- a/pkg/commands/sync.go +++ b/pkg/commands/sync.go @@ -24,6 +24,15 @@ func (c *GitCommand) usingGpg() bool { // Push pushes to a branch func (c *GitCommand) Push(branchName string, force bool, upstream string, args string, promptUserForCredential func(string) string) error { + followTagsFlag := "--follow-tags" + followsign, _ := c.getLocalGitConfig("push.followTags") + if followsign == "" { + followsign, _ = c.getGlobalGitConfig("push.followTags") + if followsign == "false" { + followTagsFlag = "" + } + } + forceFlag := "" if force { forceFlag = "--force-with-lease" @@ -34,7 +43,7 @@ func (c *GitCommand) Push(branchName string, force bool, upstream string, args s setUpstreamArg = "--set-upstream " + upstream } - cmd := fmt.Sprintf("git push --follow-tags %s %s %s", forceFlag, setUpstreamArg, args) + cmd := fmt.Sprintf("git push %s %s %s %s", followTagsFlag, forceFlag, setUpstreamArg, args) return c.OSCommand.DetectUnamePass(cmd, promptUserForCredential) } |