Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / Source

The Git blob hash

Git's own object hash: SHA-1 over a header and the file's bytes. A span of a file cannot be checked, so the whole file is hashed.

PINNED SOURCE Copied from the repository at this commit. Source, not an execution.

PHAROS at 975a38dMIT license

git_blob_shabackend/app/codeintel/source.py, lines 85–86Open source
def git_blob_sha(data: bytes) -> str:    return hashlib.sha1(b"blob %d\0" % len(data) + data).hexdigest()

Where this comes from

Commit
975a38d5d17839c26ee219295a5be6ac66b6d910
File
backend/app/codeintel/source.py
Lines
85–86
Git blob
c9f05cf7bf871b09919d64e9fdaf8380ecc3df2c
License
MIT, © 2024–2026 Pharos Contributors. Notice

Read it on GitHub at this commit

Check it yourself

From a clone of the repository, the first command prints the blob above and the second prints these lines.

git rev-parse 975a38d:backend/app/codeintel/source.py
git show 975a38d:backend/app/codeintel/source.py | sed -n '85,86p'