MCPcopy Create free account
hub / github.com/code-pushup/cli / safeCheckout

Function safeCheckout

packages/utils/src/lib/git/git.ts:89–102  ·  view source on GitHub ↗
(
  branchOrHash: string,
  forceCleanStatus = false,
  git = simpleGit(),
)

Source from the content-addressed store, hash-verified

87}
88
89export async function safeCheckout(
90 branchOrHash: string,
91 forceCleanStatus = false,
92 git = simpleGit(),
93): Promise<void> {
94 // git requires a clean history to check out a branch
95 if (forceCleanStatus) {
96 await git.raw(['reset', '--hard']);
97 await git.clean(['f', 'd']);
98 logger.info(`git status cleaned`);
99 }
100 await guardAgainstLocalChanges(git);
101 await git.checkout(branchOrHash);
102}

Callers 3

historyFunction · 0.90
handlerFunction · 0.90
git.int.test.tsFile · 0.85

Calls 2

guardAgainstLocalChangesFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected