module

Hwaro::Core::Build::GitInfo

Constants

LOG_FORMAT = "%x00%H%x00%aI%x00%an%x00%ae"

Each commit header is a NUL-led record so it can never be confused with a pathname line: \0<hash>\0<author date, RFC 3339>\0<name>\0<email>. --name-only then lists the touched paths one per line.

Instance methods

collect(content_dir : String = "content") : Hash(String, Models::GitInfo) | Nil

Collect commit metadata for every file under content_dir, keyed by path relative to it. Returns nil (after warning) when git history is unavailable for any reason.

Source
key(path : String) : String

Map key for a content-relative path: NFC-folded when non-ASCII. git on macOS prints precomposed (NFC) names while a Finder/zip-created file can sit on disk decomposed (NFD), so a byte-wise lookup with the on-disk page path missed and dropped page.git for that file.

Source
parse_log(output : String) : Hash(String, Models::GitInfo)

Parse git log output produced with LOG_FORMAT + --name-only. The log is newest-first, so the first header a path appears under is its latest commit (hash, author, lastmod); first_commit is the minimum author date over every commit listing the path (rebased or cherry-picked history can leave author dates out of walk order).

Source
unquote_path(raw : String) : String

With core.quotePath=false git still C-quotes a path that holds a control character, a double quote or a backslash. Undo that so the key matches the page path the ReadContent phase derived from disk.

Source