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

Function applyLocalOnlyGitignore

src/bin/codegraph.ts:736–755  ·  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

734
735/** `init --local-only`: make the project's `.gitignore` ignore itself, and say what happened. */
736function applyLocalOnlyGitignore(
737 clack: { log: { success(message: string): void; info(message: string): void; warn(message: string): void } },
738 projectPath: string,
739): void {
740 const file = `${path.basename(getCodeGraphDir(projectPath))}/.gitignore`;
741 switch (makeGitignoreLocalOnly(projectPath)) {
742 case 'written':
743 clack.log.success(`${file} now ignores itself, so nothing of CodeGraph's shows in git.`);
744 break;
745 case 'unchanged':
746 clack.log.info(`${file} already ignores itself.`);
747 break;
748 case 'customized':
749 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.`);
750 break;
751 case 'tracked':
752 clack.log.warn(`Left ${file} as it is because it is committed to this repository, so changing it would show up in git.`);
753 break;
754 }
755}
756
757/**
758 * 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