Skip to content

Commit

Permalink
fix(git-sw): incorrect current profile in git directory
Browse files Browse the repository at this point in the history
  • Loading branch information
thansetan committed Jul 9, 2024
1 parent 9f3f8ec commit 8da0618
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions git.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,13 @@ func applyConfig(configPath string, isGlobal bool) error {
func getCurrentConfig() (string, error) {
var cmd *exec.Cmd
if !isGlobal && isGitDirectory() {
cmd = exec.Command("git", "config", "--get", "include.path", fmt.Sprintf("%s.*gitconfig$", saveDirName))
cmd = exec.Command("git", "config", "--worktree", "--get", "include.path", fmt.Sprintf("%s.*gitconfig$", saveDirName))
} else {
cmd = exec.Command("git", "config", "--global", "--get", "include.path", fmt.Sprintf("%s.*gitconfig$", saveDirName))
}
gitOutput, err := cmd.CombinedOutput()
if err != nil && cmd.ProcessState.ExitCode() != 1 {
fmt.Println(string(gitOutput))
fmt.Println(cmd.String())
fmt.Printf("git: %s", string(gitOutput))
return "", err
}
return string(gitOutput), nil
Expand Down

0 comments on commit 8da0618

Please sign in to comment.