IsChiefIgnored checks if .chief is gitignored either locally or globally. Returns true if .chief is already ignored, false otherwise.
(dir string)
| 12 | // IsChiefIgnored checks if .chief is gitignored either locally or globally. |
| 13 | // Returns true if .chief is already ignored, false otherwise. |
| 14 | func IsChiefIgnored(dir string) bool { |
| 15 | // Use git check-ignore which respects both local and global gitignore |
| 16 | cmd := exec.Command("git", "check-ignore", "-q", ".chief") |
| 17 | cmd.Dir = dir |
| 18 | err := cmd.Run() |
| 19 | // Exit code 0 means it IS ignored, exit code 1 means it's NOT ignored |
| 20 | return err == nil |
| 21 | } |
| 22 | |
| 23 | // AddChiefToGitignore adds .chief to the local .gitignore file. |
| 24 | // Creates the file if it doesn't exist. |
no test coverage detected