MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / applyLocalOnlyGitignore

Function applyLocalOnlyGitignore

src/bin/codegraph.ts:726–745  ·  view source on GitHub ↗

`init --local-only`: make the project's `.gitignore` ignore itself, and say what happened.

(
  clack: { log: { success(message: string): void; info(message: string): void; warn(message: string): void } },
  projectPath: string,
)

Source from the content-addressed store, hash-verified

724
725/** `init --local-only`: make the project's `.gitignore` ignore itself, and say what happened. */
726function applyLocalOnlyGitignore(
727 clack: { log: { success(message: string): void; info(message: string): void; warn(message: string): void } },
728 projectPath: string,
729): void {
730 const file = `${path.basename(getCodeGraphDir(projectPath))}/.gitignore`;
731 switch (makeGitignoreLocalOnly(projectPath)) {
732 case 'written':
733 clack.log.success(`${file} now ignores itself, so nothing of CodeGraph's shows in git.`);
734 break;
735 case 'unchanged':
736 clack.log.info(`${file} already ignores itself.`);
737 break;
738 case 'customized':
739 clack.log.warn(`Left ${file} as it is because it has your own rules. A lone * in it would keep the whole folder out of git.`);
740 break;
741 case 'tracked':
742 clack.log.warn(`Left ${file} as it is because it is committed to this repository, so changing it would show up in git.`);
743 break;
744 }
745}
746
747/**
748 * What `status` and `init` say about an index whose last run didn't end well:

Callers 1

runInitFunction · 0.85

Calls 4

getCodeGraphDirFunction · 0.90
makeGitignoreLocalOnlyFunction · 0.90
infoMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected