Skip to content

Commit

Permalink
don't specify --path in gitutil.Config and specify --bool when gettin…
Browse files Browse the repository at this point in the history
…g ghq.completeUser
  • Loading branch information
Songmu committed May 12, 2019
1 parent dd4ca00 commit a68bebb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gitutil/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import (
// ConfigSingle fetches single git-config variable.
// returns an empty string and no error if no variable is found with the given key.
func ConfigSingle(key string) (string, error) {
return Config("--get", key)
return Config("--path", "--get", key)
}

// ConfigAll fetches git-config variable of multiple values.
func ConfigAll(key string) ([]string, error) {
value, err := Config("--get-all", key)
value, err := Config("--path", "--get-all", key)
if err != nil {
return nil, err
}
Expand All @@ -34,7 +34,7 @@ func ConfigAll(key string) ([]string, error) {

// Config invokes 'git config' and handles some errors properly.
func Config(args ...string) (string, error) {
gitArgs := append([]string{"config", "--path", "--null"}, args...)
gitArgs := append([]string{"config", "--null"}, args...)
cmd := exec.Command("git", gitArgs...)
cmd.Stderr = os.Stderr

Expand Down
2 changes: 1 addition & 1 deletion remote_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (repo *OtherRepository) VCS() (*VCSBackend, *url.URL) {
// (in gitconfig:)
// [ghq "https://ghe.example.com/"]
// vcs = github
vcs, err := gitutil.Config("--get-urlmatch", "ghq.vcs", repo.URL().String())
vcs, err := gitutil.Config("--path", "--get-urlmatch", "ghq.vcs", repo.URL().String())
if err != nil {
logger.Log("error", err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion url.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func convertGitURLHTTPToSSH(url *url.URL) (*url.URL, error) {
}

func fillUsernameToPath(path string) (string, error) {
completeUser, err := gitutil.ConfigSingle("ghq.completeUser")
completeUser, err := gitutil.Config("--bool", "--get", "ghq.completeUser")
if err != nil {
return path, err
}
Expand Down

0 comments on commit a68bebb

Please sign in to comment.