MCPcopy Index your code
hub / github.com/code-pushup/cli / getGitDefaultBranch

Function getGitDefaultBranch

packages/utils/src/lib/git/git.ts:11–21  ·  view source on GitHub ↗
(git = simpleGit())

Source from the content-addressed store, hash-verified

9}
10
11export async function getGitDefaultBranch(git = simpleGit()): Promise<string> {
12 try {
13 const head = await git.revparse(['--abbrev-ref', 'origin/HEAD']);
14 return head.replace(/^origin\//, '');
15 } catch (error) {
16 logger.warn(
17 `Failed to get the default Git branch, falling back to main - ${stringifyError(error)}`,
18 );
19 return 'main';
20 }
21}
22
23export function formatGitPath(filePath: string, gitRoot: string): string {
24 const absolutePath = path.isAbsolute(filePath)

Callers 2

generateGitHubYamlFunction · 0.90
git.int.test.tsFile · 0.85

Calls 2

warnMethod · 0.80
stringifyErrorFunction · 0.50

Tested by

no test coverage detected