Add a shared git snapshot provider for HEAD, dirty worktree hash, and tracked file count. The provider uses the existing portable command fallback, streams status output with O(1) buffer memory, keeps clean trees unambiguous, and supports non-git fallback without changing incremental defaults.
Migrate watcher polling to the provider with flags so baseline still avoids dirty-status work, normal polls check HEAD plus dirty state, and post-index refresh updates HEAD, dirty hash, and file count together.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=watcher ./build/c/test-runner. Pipeline suite also passed after adding git_snapshot to the shared test runner link before the final dirty-hash clean-state tweak.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Centralize git command formatting, path validation, null-device selection, first-line capture, and command-size checks for git context and watcher code.
This keeps the current command fallback behavior, makes Windows shell metacharacter handling consistent, replaces a touched watcher strdup path with cbm_strdup, and prepares the next git snapshot/pre-discovery acceleration slice without adding a new default route.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=watcher ./build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner.
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>
Remove git_context.c's private strdup helper and replace literal command/output buffer sizes with CBM-prefixed constants backed by the repository size constants.
This is a prerequisite cleanup for a future shared git snapshot boundary; it does not change command syntax, dependencies, pipeline routing, stdout/stderr behavior, or default incremental behavior.
Validation: git diff --check; bash scripts/check-source-safety.sh; make -j8 -f Makefile.cbm build/c/test-runner; CBM_ONLY_SUITE=pipeline ./build/c/test-runner (282 passed).
Signed-off-by: Andrew Hundt <ATHundt@gmail.com>