summaryrefslogtreecommitdiffstats
path: root/pkg/commands/sync.go
diff options
context:
space:
mode:
authorNathan Bell <nbell@lucidchart.com>2020-11-23 12:04:15 -0700
committerJesse Duffield <jessedduffield@gmail.com>2020-11-25 08:41:22 +1100
commitc4cce584643776b06ac1b525e207bb25bcdf3241 (patch)
tree745e2b82174e078dddfe49dc20405f01da1faa27 /pkg/commands/sync.go
parentf7e6d4e7248293dc1a70a2c616d8a5334dee07f8 (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.go11
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)
}