Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
read_file_at_commit
codeintel.git_source.read_file_at_commit
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| _load | source.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| git_source | git_source.py | same file |
codeintel.git_source.read_file_at_commitbackend/app/codeintel/git_source.py, lines 446–461Open source
def read_file_at_commit(git_dir: str, commit: str, path: str) -> bytes: """Read ``path`` at ``commit`` from a local repository (code resolution).""" if not _SHA_RE.match(commit): raise ValueError("commit must be a full SHA") if path.startswith("/") or ".." in path.split("/"): raise ValueError("invalid path") proc = subprocess.run( ["git", f"--git-dir={git_dir}", "cat-file", "blob", f"{commit}:{path}"], capture_output=True, timeout=30, env=_git_env(), check=False, ) if proc.returncode != 0: raise GitError("file not found at commit", retryable=False) return proc.stdoutWhat the index recorded
- Signature
def read_file_at_commit(git_dir: str, commit: str, path: str) -> bytes:- File
backend/app/codeintel/git_source.py- Lines
- 446–461
- Parser
- python-ast
- Git blob
6f88470169e4935929c5f865a974bd86da564c1a- Call sites
- 7 named, 2 resolved, 5 left unlinked
