* Static method to get the singleton instance of the `GitClient`, * creating it, if not created yet.
()
| 235 | * creating it, if not created yet. |
| 236 | */ |
| 237 | static async get(): Promise<GitClient> { |
| 238 | // If there is no cached instance, create one and cache the promise immediately. |
| 239 | // This avoids constructing a client twice accidentally when e.g. waiting for the |
| 240 | // configuration to be loaded. |
| 241 | if (GitClient._unauthenticatedInstance === null) { |
| 242 | GitClient._unauthenticatedInstance = (async () => { |
| 243 | return new GitClient(await getConfig([assertValidGithubConfig])); |
| 244 | })(); |
| 245 | } |
| 246 | |
| 247 | return GitClient._unauthenticatedInstance; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /** |