diff options
Diffstat (limited to 'pkg/commands/git_config/get_key.go')
-rw-r--r-- | pkg/commands/git_config/get_key.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pkg/commands/git_config/get_key.go b/pkg/commands/git_config/get_key.go index 4ad5ae63e..bd6f59248 100644 --- a/pkg/commands/git_config/get_key.go +++ b/pkg/commands/git_config/get_key.go @@ -35,11 +35,8 @@ import ( // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -func getGitConfigValue(key string) (string, error) { - // allowing caller to say that key is '--local mykey' so that they can add extra flags. - gitArgs := append([]string{"config", "--get", "--null"}, strings.Split(key, " ")...) +func runGitConfigCmd(cmd *exec.Cmd) (string, error) { var stdout bytes.Buffer - cmd := secureexec.Command("git", gitArgs...) cmd.Stdout = &stdout cmd.Stderr = ioutil.Discard @@ -55,3 +52,13 @@ func getGitConfigValue(key string) (string, error) { return strings.TrimRight(stdout.String(), "\000"), nil } + +func getGitConfigCmd(key string) *exec.Cmd { + gitArgs := []string{"config", "--get", "--null", key} + return secureexec.Command("git", gitArgs...) +} + +func getGitConfigGeneralCmd(args string) *exec.Cmd { + gitArgs := append([]string{"config"}, strings.Split(args, " ")...) + return secureexec.Command("git", gitArgs...) +} |