grokkit/internal/git/git.go
Greg Gauthier 9bd3e1d00e refactor: add error handling and refactor git utilities
- Enhance error checking in all commands using git.Run
- Refactor git helper to return errors properly
- Fix README.md filename typo
- Update .gitignore with additional ignores
- Add fallback for config home dir
- Improve request handling in grok client
2026-03-01 12:08:49 +00:00

20 lines
359 B
Go

package git
import (
"fmt"
"os/exec"
)
func Run(args []string) (string, error) {
out, err := exec.Command("git", args...).Output()
if err != nil {
return "", fmt.Errorf("git command failed: %w", err)
}
return string(out), nil
}
func IsRepo() bool {
_, err := exec.Command("git", "rev-parse", "--is-inside-work-tree").Output()
return err == nil
}