MCPcopy Index your code
hub / github.com/ampproject/amphtml / getRepoRoot

Function getRepoRoot

build-system/task-runner/amp-cli-runner.js:19–26  ·  view source on GitHub ↗

* Returns the current git repo's root directory if we are inside one. * @return {string|undefined}

()

Source from the content-addressed store, hash-verified

17 * @return {string|undefined}
18 */
19function getRepoRoot() {
20 const repoRootCmd = 'git rev-parse --show-toplevel';
21 const result = childProcess.spawnSync(repoRootCmd, {
22 shell: process.platform == 'win32' ? 'cmd' : '/bin/bash',
23 encoding: 'utf-8',
24 });
25 return result.status == 0 ? result.stdout.trim() : undefined;
26}
27
28/**
29 * Invokes the repo-local `amp` task runner if we are inside a git repository.

Callers 1

invokeAmpTaskRunnerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected