MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / build_git_cmd

Function build_git_cmd

src/pipeline/artifact.c:380–386  ·  view source on GitHub ↗

Build `git -C " " 2> ` with a shell-validated repo path. * repo_path is the only untrusted component; args is a trusted literal or a * hex-validated commit string (never arbitrary data). Returns false on * shell-arg validation failure or truncation. */

Source from the content-addressed store, hash-verified

378 * hex-validated commit string (never arbitrary data). Returns false on
379 * shell-arg validation failure or truncation. */
380static bool build_git_cmd(char *buf, size_t bufsz, const char *repo_path, const char *args) {
381 if (!cbm_artifact_repo_path_is_shell_safe(repo_path)) {
382 return false;
383 }
384 int n = snprintf(buf, bufsz, "git -C \"%s\" %s 2>" ARTIFACT_NULL_DEV, repo_path, args);
385 return n >= 0 && (size_t)n < bufsz;
386}
387
388/* Run a git command; return true iff it exits 0. Output is drained (not kept)
389 * so `diff --quiet` semantics work and large outputs don't SIGPIPE. */

Callers 2

git_run_okFunction · 0.85
git_capture_fullFunction · 0.85

Tested by

no test coverage detected