MCPcopy Create free account
hub / github.com/alibaba/open-code-review / git

Function git

scripts/github-actions/check-pr-commit-policy.test.js:370–386  ·  view source on GitHub ↗
(args, allowedStatuses = [0])

Source from the content-addressed store, hash-verified

368 test(`policy checkout preserves source for later jobs in a ${initialState} workspace`, () => {
369 const directory = fs.mkdtempSync(path.join(os.tmpdir(), "ocr-pr-policy-checkout-"));
370 const git = (args, allowedStatuses = [0]) => {
371 const result = spawnSync("git", args, {
372 cwd: directory,
373 encoding: "utf8",
374 timeout: 10000,
375 env: {
376 ...process.env,
377 HOME: directory,
378 LC_ALL: "C",
379 GIT_CONFIG_NOSYSTEM: "1",
380 GIT_CONFIG_GLOBAL: os.devNull,
381 },
382 });
383 assert.ifError(result.error);
384 assert.ok(allowedStatuses.includes(result.status), `git ${args.join(" ")}: ${result.stderr}`);
385 return result.stdout.trim();
386 };
387 const policyPath = "scripts/github-actions/check-pr-commit-policy.js";
388 const files = {
389 "go.mod": "module example.test/checkout\n",

Calls

no outgoing calls

Tested by

no test coverage detected