{"record":{"id":"d68d22d6507ea84c","repo":"gitbutlerapp/gitbutler","slug":"gerrit-push-flags-wip-ready-hashtag-tag","errorCode":null,"errorMessage":"Gerrit push flags (--wip, --ready, --hashtag/--tag, --topic, --topic-from-branch, --private) can only be used when gerrit_mode is enabled for this repository","messagePattern":"Gerrit push flags \\(--wip, --ready, --hashtag/--tag, --topic, --topic-from-branch, --private\\) can only be used when gerrit_mode is enabled for this repository","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/push.rs","lineNumber":1053,"sourceCode":"    branches_info.sort_by(|a, b| a.2.cmp(&b.2).then(a.0.cmp(&b.0)));\n\n    Ok(branches_info)\n}\n\npub fn get_gerrit_flags(\n    args: &Command,\n    branch_name: &str,\n    gerrit_mode: bool,\n) -> anyhow::Result<Vec<but_gerrit::PushFlag>> {\n    let has_gerrit_flag = args.wip\n        || args.ready\n        || !args.hashtag.is_empty()\n        || args.topic.is_some()\n        || args.topic_from_branch\n        || args.private;\n\n    if has_gerrit_flag && !gerrit_mode {\n        return Err(anyhow::anyhow!(\n            \"Gerrit push flags (--wip, --ready, --hashtag/--tag, --topic, --topic-from-branch, --private) can only be used when gerrit_mode is enabled for this repository\"\n        ));\n    }\n\n    if !gerrit_mode {\n        return Ok(vec![]);\n    }\n\n    let mut flags = Vec::new();\n\n    // Handle Wip/Ready - Ready is default if neither is specified\n    if args.wip {\n        flags.push(but_gerrit::PushFlag::Wip);\n    } else {\n        // Default to Ready, or explicit Ready\n        flags.push(but_gerrit::PushFlag::Ready);\n    }\n","sourceCodeStart":1035,"sourceCodeEnd":1071,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/push.rs#L1035-L1071","documentation":"`but push` reads gerrit mode from the repo's Git setting `gitbutler.gerritMode` (default false) and `get_gerrit_flags` refuses any of --wip, --ready, --hashtag/--tag, --topic, --topic-from-branch, or --private when gerrit mode is off. These flags only make sense for Gerrit's refs/for push targets, so a plain push rejects them up front.","triggerScenarios":"Running `but push --wip` (or any listed flag) in a repository where `git config gitbutler.gerritMode` is unset or false.","commonSituations":"Dotfiles or aliases carrying Gerrit flags into non-Gerrit repos; gerritMode config lost after re-cloning; a team template assumes Gerrit but the repo never opted in.","solutions":["Enable gerrit mode for this repo: `git config gitbutler.gerritMode true` (or the equivalent GitButler setting)","Or drop the flags: `but push`","Verify with `git config --get gitbutler.gerritMode`","Keep Gerrit-specific aliases scoped to Gerrit clones"],"exampleFix":"# before\nbut push --wip\n# error: Gerrit push flags ... can only be used when gerrit_mode is enabled\n\n# after\ngit config gitbutler.gerritMode true\nbut push --wip","handlingStrategy":"validation","validationCode":"# Gate Gerrit flags on the repo setting\nif [ \"$(git config --bool gitbutler.gerritMode)\" = \"true\" ]; then\n  but push --wip \"$@\"\nelse\n  but push \"$@\"\nfi","typeGuard":"fn gerrit_flags_allowed(repo: &gix::Repository) -> anyhow::Result<bool> {\n    Ok(repo.git_settings()?.gitbutler_gerrit_mode.unwrap_or(false))\n}","tryCatchPattern":null,"preventionTips":["Set gitbutler.gerritMode in repo bootstrap scripts for Gerrit projects","Scope Gerrit push aliases to Gerrit repos only","Check `git config --get gitbutler.gerritMode` before scripting Gerrit flags"],"tags":["gerrit","push","feature-flag","git-config"],"backgroundTag":"flag-requires-feature-enabled","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}