git.list_refs

git

list_refs(git_dir) -> refs

List all refs of a repository: loose and packed, with peeled ^{} entries for annotated tags

Returns a map of ref path to sha. The table is shared between calls and must not be changed: copy it first.

A call reuses the last walk while packed-refs and every directory under refs/ stat as they did. A walk is kept only when it began at least 2 seconds after the newest mtime it saw, so a ref git writes, even within the same second, shows on the next call. A ref edited in place moves no directory and can go unseen; git never writes one that way. A tag's peel is kept by the tag object's sha across walks.