fangorn/ex_git_objectstore
public
ref:main
feat: commit-ish parser (HEAD~3, main@{1}, v1.0^{commit}, short SHAs, ref@{date}) #42
open
Opened by cole.christensen@gmail.com
Links
No links yet.
Ref.resolve/2 handles exact full refs only. Every /tree/:ref/... URL in a hosting product needs to resolve arbitrary revision expressions.
Scope
Revision.parse_and_resolve(repo, spec) supports the documented git revision grammar:
- Full SHA and abbreviated SHA (with ambiguity detection)
- Refs by short name (
main), ordered lookup (refs/heads/main,refs/tags/main) @andHEADX~N,X^N,X^{tree},X^{commit},X^{tag},X^{}X@{N}(reflog — requires reflog feature #5) — optionalX@{date}— optionalrefname:path— return blob/tree at path (used by file view URLs)
Acceptance
- Fuzz-tested against
git rev-parseon a fixture repo for ≥200 expressions. - Returns
{:ok, sha, object_type}or typed error (ambiguous, not_found, invalid).