- 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
20 lines
359 B
Go
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
|
|
}
|