Skip to main content

Module identity

Module identity 

Source
Expand description

Git identity resolution with fallback chain.

This module provides a comprehensive git identity resolution system that:

  1. Works with git config as the primary source (via libgit2 in caller)
  2. Adds Ralph-specific configuration options (config file, env vars, CLI args)
  3. Implements sensible fallbacks (system username, default values)
  4. Provides clear error messages when identity cannot be determined

§Priority Chain

The identity is resolved in the following order (matches standard git behavior):

  1. Git config (via libgit2) - primary source (local .git/config, then global ~/.gitconfig)
  2. Explicit CLI args - only used when git config is missing
  3. Environment variables (RALPH_GIT_USER_NAME, RALPH_GIT_USER_EMAIL) - fallback
  4. Ralph config file ([general] section with git_user_name, git_user_email)
  5. System username + derived email (sane fallback)
  6. Default values (“Ralph Workflow”, “ralph@localhost”) - last resort

Structs§

GitIdentity
Git user identity information.

Functions§

default_identity
Get the default git identity (last resort).
fallback_email
Get a fallback email based on the username.
fallback_username
Get the system username as a fallback.