git_policy_cli/
rule_commit_only_message.rs1pub const NO_PATHSPEC_MESSAGE: &str = "cli-git: git commit requires an explicit pathspec when commit-only enforcement is active. \
16Name the paths in the commit command (for example, git commit -m <msg> <path>), \
17pass --pathspec-from-file, pass --no-only to commit the entire index, \
18or pass --no-enforce-only to bypass for this invocation.";
19
20pub const ALL_FLAG_MESSAGE: &str = "cli-git: git commit rejects -a/--all because it stages every tracked modification before committing. \
23Stage paths explicitly and commit with git commit -m <msg> <path>, \
24or pass --no-enforce-only to bypass for this invocation.";
25
26pub fn ignored_index_message(flag_text: &str) -> String {
40 return format!(
42 "cli-git: git commit {flag_text} without pathspecs would silently ignore your staged changes. \
43Commit-only enforcement injects --only, and a pathless --only commit reuses HEAD's existing tree, \
44leaving staged changes staged with no warning; the index currently differs from HEAD. \
45Choose explicitly: name the paths to include them (git commit --amend <path>), \
46pass --only to proceed without them, \
47or pass --no-only to commit the entire index."
48 );
49}