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

Function applyLocalOnlyGitignore

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

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