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