MCPcopy
hub / github.com/claude-code-best/claude-code / resolveRef

Function resolveRef

src/utils/git/gitFilesystem.ts:203–219  ·  view source on GitHub ↗
(
  gitDir: string,
  ref: string,
)

Source from the content-addressed store, hash-verified

201 * - Peeled: `^<40-hex-sha>\n` (after annotated tag entries)
202 */
203export async function resolveRef(
204 gitDir: string,
205 ref: string,
206): Promise<string | null> {
207 const result = await resolveRefInDir(gitDir, ref)
208 if (result) {
209 return result
210 }
211
212 // For worktrees: try the common gitdir where shared refs live
213 const commonDir = await getCommonDir(gitDir)
214 if (commonDir && commonDir !== gitDir) {
215 return resolveRefInDir(commonDir, ref)
216 }
217
218 return null
219}
220
221async function resolveRefInDir(
222 dir: string,

Callers 7

getOrCreateWorktreeFunction · 0.85
readGitHeadFunction · 0.85
resolveRefInDirFunction · 0.85
computeHeadFunction · 0.85
computeDefaultBranchFunction · 0.85
getHeadForDirFunction · 0.85
readWorktreeHeadShaFunction · 0.85

Calls 2

resolveRefInDirFunction · 0.85
getCommonDirFunction · 0.85

Tested by

no test coverage detected