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:
- Git config (via libgit2) - primary source
- Provided
git_user_nameandgit_user_emailparameters (overrides) - Environment variables (
RALPH_GIT_USER_NAME,RALPH_GIT_USER_EMAIL) - Ralph config file (read by caller, passed as parameters)
- System username + derived email (sane fallback)
- 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.
§Arguments
message- The commit messagegit_user_name- Optional git user name (overrides git config)git_user_email- Optional git user email (overrides git config)executor- Optional process executor for system username/hostname lookup
§Returns
Returns Ok(Some(oid)) with the commit OID if successful, Ok(None) if the
OID is zero (no commit created), or an error if the operation failed.