Skip to content

aa

数据定义

rust
let s= String::from("hello")

引用与借用

  • &s 取地址符号,不可变引用
  • &mut s 取可变引用 地址符号,对于一个变量,只能有一个
  • s 获取所有权
const CORE_GIT_HOOK_NAMES: &[&str] = &[
    "pre-commit",
    "post-commit",
];
fn hook_perf_json_logging_enabled() -> bool {
    std::env::var("GIT_AI_DEBUG_PERFORMANCE")
        .ok()
        .and_then(|value| value.trim().parse::<u8>().ok())
        .map(|level| level >= 2)
        .unwrap_or(false)
}
// 如果环境变量 GIT_AI_SKIP_ALL_HOOKS 设置为 1,则跳过所有 Hook
if std::env::var(ENV_SKIP_ALL_HOOKS).as_deref() == Ok("1") {
    return 0;
}
.then()
GIT_AI_DEBUG_PERFORMANCE
GIT_AI_DEBUG_PERFORMANCE=1 git-ai <command>
GIT_AI_DEBUG_PERFORMANCE=2

debug_performance_log_structured

  • is_git_hook_binary_name

上次更新时间:

最近更新