Skip to content

Commit f845a35

Browse files
frits-vclaude
andcommitted
refactor(gitcheck): clarify RE_CMD_SEP regex and document alternation order
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ec87689 commit f845a35

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ All shell scripts follow the [Google Shell Style Guide](https://google.github.io
177177

178178
## Testing
179179

180-
219 tests (166 unit + 5 doc + 13 integration + 10 proptest + 25 memory) plus 4 fuzz targets.
180+
258 tests (204 hooks unit + 5 claude_md + 13 integration + 10 proptest + 22 memory unit + 4 memory integration) plus 4 fuzz targets.
181181
Run with `make test` or `cargo test`.
182182

183183
Test patterns:

hooks/src/gitcheck.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ static RE_GIT_C: LazyLock<Regex> =
6161
static RE_CD_PATH: LazyLock<Regex> =
6262
LazyLock::new(|| Regex::new(r#"\bcd\s+("[^"]+"|'[^']+'|\S+)"#).unwrap());
6363
// Bare mutating git detection (segment splitting + subcommand extraction)
64-
static RE_CMD_SEP: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"&&|\|\||[;&|]").unwrap());
64+
// Matches &&, ||, then single ;, |, or & (background). || before [;|&] so double-pipe isn't split.
65+
static RE_CMD_SEP: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"&&|\|\||[;|&]").unwrap());
6566
static RE_GIT_WORD_BOUNDARY: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\bgit\b").unwrap());
6667

6768
/// Mutating git subcommands that must target a worktree, not CWD.

0 commit comments

Comments
 (0)