| 161 | } |
| 162 | |
| 163 | export async function loadCommitHistory(): Promise<string[]> { |
| 164 | try { |
| 165 | // returns an list of commit hashes |
| 166 | const { stdout, stderr } = await exec({ command: 'git log --pretty=format:"%h"' }) |
| 167 | if (stderr) { |
| 168 | return [] |
| 169 | } |
| 170 | // string match on remote output |
| 171 | return stdout.split('\n') |
| 172 | } catch (error: any) { |
| 173 | // likely no git setup or no commits |
| 174 | logger(`Warn: ${error.message}`) |
| 175 | return [] |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | // return the short form of a hash (first 7 characters) |
| 180 | // using `git rev-parse` seems unnecessarily slower |