Files
kandev/apps/backend/internal/task/gitinit/command_path.go
T
2026-08-05 22:34:26 +01:00

33 lines
941 B
Go

//go:build !linux && !darwin
package gitinit
import (
"context"
"fmt"
"os"
"os/exec"
"github.com/kandev/kandev/internal/common/subproc"
)
// CommandContext creates a Git initialization command for platforms without inherited fd support.
func CommandContext(ctx context.Context, targetPath string, _ *os.File) (*exec.Cmd, error) {
command := subproc.NewGitCommand(ctx, "init", "--initial-branch=main")
command.Dir = targetPath
return command, nil
}
// CommitCommandContext creates a Git commit command for targetPath.
func CommitCommandContext(ctx context.Context, targetPath string, _ *os.File, args ...string) (*exec.Cmd, error) {
command := subproc.NewGitCommand(ctx, args...)
command.Dir = targetPath
command.Env = withIsolatedCommitEnvironment(os.Environ())
return command, nil
}
func runInheritedDirectory(string, []string) int {
fmt.Fprintln(os.Stderr, "git init helper is unsupported on this platform")
return 2
}