Files

22 lines
724 B
Go

package worktree
import (
"context"
"os/exec"
"github.com/kandev/kandev/internal/common/subproc"
)
// newGitCommand enables Git's long-path handling for this process only. Git
// accepts the setting on every supported platform, so using the same command
// shape everywhere keeps all package-owned Git invocations on one safe path
// without mutating repository, global, or system configuration.
func newGitCommand(ctx context.Context, args ...string) *exec.Cmd {
commandArgs := make([]string, 0, len(args))
commandArgs = append(commandArgs, "-c", "core.longpaths=true")
commandArgs = append(commandArgs, args...)
cmd := subproc.NewGitCommand(ctx, commandArgs...)
configureCheckoutCommand(ctx, cmd)
return cmd
}