MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / isInsideGitRepo

Function isInsideGitRepo

packages/cli/src/utils/git.ts:25–37  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

23
24/** @returns Whether or not this directory or a parent directory has a `.git` directory. */
25const isInsideGitRepo = async (dir: string): Promise<boolean> => {
26 try {
27 // If this command succeeds, we're inside a git repo
28 await execa("git", ["rev-parse", "--is-inside-work-tree"], {
29 cwd: dir,
30 stdout: "ignore",
31 });
32 return true;
33 } catch (_e) {
34 // Else, it will throw a git-error and we return false
35 return false;
36 }
37};
38
39const getGitVersion = () => {
40 const stdout = execSync("git --version").toString().trim();

Callers 1

initializeGitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…