Skip to main content

Module gitops

Module gitops 

Source
Expand description

受控 git 操作:仅在 orz_ser 进程内的 task_done 流程调用。

设计约束(安全):

  • 只用 std::process::Command 执行固定参数的 git 命令,禁止拼接任意命令字符串,不引入 shell 注入;
  • git 身份可由环境变量 ORZ_GIT_USER / ORZ_GIT_EMAIL 覆盖,缺省 orz <orz@local>;
  • task_done 调用 commit_all 产生恰好一次提交;无未提交改动时跳过(避免空提交)。

Functions§

commit_all
git add -A + commit。已提交返回 Ok(true);无改动(空提交)返回 Ok(false)并跳过。
has_uncommitted_changes
工作区是否有未提交改动(含未跟踪文件)。用 git status --porcelain 判断。