MCPcopy Create free account
hub / github.com/SethGammon/Citadel / gitExec

Function gitExec

scripts/watch.js:224–230  ·  view source on GitHub ↗

* Execute a git command safely using execFileSync (array args — never shell-interpolated). * @param {string[]} args - Git arguments as an array (e.g. ['diff', '--name-only', 'HEAD']) * @returns {string} stdout, trimmed. Empty string on error.

(args)

Source from the content-addressed store, hash-verified

222 * @returns {string} stdout, trimmed. Empty string on error.
223 */
224function gitExec(args) {
225 try {
226 return execFileSync('git', args, { cwd: ROOT, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
227 } catch {
228 return '';
229 }
230}
231
232function getCurrentHead() {
233 return gitExec(['rev-parse', 'HEAD']);

Callers 2

getCurrentHeadFunction · 0.85
getChangedFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected