Skip to main content

extract_git_context

Function extract_git_context 

Source
pub fn extract_git_context() -> Result<GitContext>
Expand description

Extract git context for the current commit

Returns context including HEAD SHA, parent SHAs, timestamp, and branch name. Handles detached HEAD (branch = None) and shallow clones gracefully.

§Errors

Returns error if:

  • Not in a git repository
  • Git commands fail for reasons other than shallow history

§Shallow Clone Handling

If parent SHAs cannot be resolved (shallow clone), this function warns and continues. Missing parents are treated as baseline = true.