( gitDir: string, ref: string, )
| 201 | * - Peeled: `^<40-hex-sha>\n` (after annotated tag entries) |
| 202 | */ |
| 203 | export 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 | |
| 221 | async function resolveRefInDir( |
| 222 | dir: string, |
no test coverage detected