git.expand_sha

git

expand_sha(git_dir, prefix) -> sha, err

Expand an abbreviated object id to its full 40-hex form

Resolves a short object id the way git does: loose objects and every pack index are searched for ids starting with prefix. Returns nil and "ambiguous object id" when more than one object matches, so a caller never acts on a guess. A full 40-character id is returned unchanged without touching the object database.