Skip to main content

git_commit

Function git_commit 

Source
pub fn git_commit(
    message: &str,
    git_user_name: Option<&str>,
    git_user_email: Option<&str>,
    executor: Option<&dyn ProcessExecutor>,
) -> Result<Option<Oid>>
Expand description

Create a commit.

Similar to git commit -m <message>.

Handles both initial commits (no HEAD yet) and subsequent commits.

§Identity Resolution

The git commit identity (name and email) is resolved using the following priority:

  1. Git config (via libgit2) - primary source
  2. Provided git_user_name and git_user_email parameters (overrides)
  3. Environment variables (RALPH_GIT_USER_NAME, RALPH_GIT_USER_EMAIL)
  4. Ralph config file (read by caller, passed as parameters)
  5. System username + derived email (sane fallback)
  6. Default values (“Ralph Workflow”, “ralph@localhost”) - last resort

Partial overrides are supported: CLI args/env vars/config can override individual fields (name or email) from git config.