Skip to main content

build_commit_argv

Function build_commit_argv 

Source
pub fn build_commit_argv(
    message: &str,
    paths: &[String],
    author: Option<&str>,
) -> Result<Vec<String>, GitArgError>
Expand description

Builds the argv for git commit.

  • paths empty: ["commit", "-a", "-m", message] (or with --author=) – commits everything currently staged/modified in tracked files, never auto-adds new untracked files.
  • paths non-empty: ["commit", "-m", message, "--", paths...] (or with --author=) – scoped to exactly the given paths, which the caller must have already staged via the paired git add step (build_add_argv).