ListTrackedFiles returns absolute paths for files tracked in the git index.
(repoPath string)
| 9 | |
| 10 | // ListTrackedFiles returns absolute paths for files tracked in the git index. |
| 11 | func ListTrackedFiles(repoPath string) ([]string, error) { |
| 12 | repoRoot, err := ensureRepoRoot(repoPath) |
| 13 | if err != nil { |
| 14 | return nil, err |
| 15 | } |
| 16 | |
| 17 | stdout, stderr, err := runGitCommand(repoPath, "ls-files", "-z", "--cached") |
| 18 | if err != nil { |
| 19 | return nil, gitCommandError(err, stderr) |
| 20 | } |
| 21 | |
| 22 | return toAbsolutePaths(repoRoot, parseNullSeparatedPaths(stdout)), nil |
| 23 | } |
| 24 | |
| 25 | // ListUntrackedFiles returns absolute paths for non-ignored untracked files. |
| 26 | func ListUntrackedFiles(repoPath string) ([]string, error) { |
no test coverage detected