MCPcopy Index your code
hub / github.com/remix-run/react-router / getFileSha

Function getFileSha

scripts/utils/git.ts:139–153  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

137 * Falls back to HEAD if the file has no git history (e.g., untracked or newly staged).
138 */
139export function getFileSha(filePath: string): string {
140 let normalizedPath = filePath.replaceAll("\\", "/");
141 try {
142 let sha = execGit([
143 "log",
144 "-1",
145 "--diff-filter=A",
146 "--format=%H",
147 "--",
148 normalizedPath,
149 ]);
150 if (sha) return sha;
151 } catch {}
152 return execGit(["rev-parse", "HEAD"]);
153}
154
155/**
156 * Gets the subject line (first line) of a commit message for a given SHA.

Callers 1

parsePackageChangesFunction · 0.90

Calls 1

execGitFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…