Read returns the full content of a file path (relative to RepoDir), resolved according to the active review mode. - Workspace: reads directly from the filesystem. - Range / Commit: uses `git show : ` to read at the given ref.
(ctx context.Context, path string)
| 66 | // - Workspace: reads directly from the filesystem. |
| 67 | // - Range / Commit: uses `git show <Ref>:<path>` to read at the given ref. |
| 68 | func (fr *FileReader) Read(ctx context.Context, path string) (string, error) { |
| 69 | switch fr.Mode { |
| 70 | case ModeWorkspace: |
| 71 | return fr.readFromDisk(path) |
| 72 | case ModeRange, ModeCommit: |
| 73 | return fr.readFromGitShow(ctx, path) |
| 74 | default: |
| 75 | return fr.readFromDisk(path) |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | func (fr *FileReader) readFromDisk(path string) (string, error) { |
| 80 | fullPath, err := fr.resolveWorkspacePath(path) |