(projectRoot, ref)
| 120 | } |
| 121 | |
| 122 | function resolveGitRef(projectRoot, ref) { |
| 123 | if (!ref) return null; |
| 124 | try { |
| 125 | return childProcess.execFileSync('git', ['rev-parse', '--verify', ref], { |
| 126 | cwd: projectRoot, |
| 127 | encoding: 'utf8', |
| 128 | stdio: ['ignore', 'pipe', 'ignore'], |
| 129 | }).trim().slice(0, 7); |
| 130 | } catch { |
| 131 | return null; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | function currentBranchHead(projectRoot, branch, options = {}) { |
| 136 | if (!branch) return null; |