From c4cce584643776b06ac1b525e207bb25bcdf3241 Mon Sep 17 00:00:00 2001 From: Nathan Bell Date: Mon, 23 Nov 2020 12:04:15 -0700 Subject: [PATCH] Allow --follow-tags to be disabled if push.followTags is configured to false --- pkg/commands/sync.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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) }