GitCommitContentReader returns a ContentReader that reads file content from a specific git commit.
(repoPath, commitID string)
| 8 | |
| 9 | // GitCommitContentReader returns a ContentReader that reads file content from a specific git commit. |
| 10 | func GitCommitContentReader(repoPath, commitID string) vcs.ContentReader { |
| 11 | return func(absPath string) ([]byte, error) { |
| 12 | relPath := getRelativePath(absPath, repoPath) |
| 13 | return GetFileContentFromCommit(repoPath, commitID, relPath) |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | // GetRelativePath converts an absolute file path to a path relative to the repository root |
| 18 | func getRelativePath(absPath, repoPath string) string { |
no test coverage detected