Git - gif config should not throw if key does not exist (#200358)

This commit is contained in:
Ladislau Szomoru 2023-12-08 15:10:52 +01:00 committed by GitHub
parent 2018d1523e
commit b0b6913211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -1017,8 +1017,14 @@ export class Repository {
args.push(value);
}
const result = await this.exec(args, options);
return result.stdout.trim();
try {
const result = await this.exec(args, options);
return result.stdout.trim();
}
catch (err) {
this.logger.warn(`git config failed: ${err.message}`);
return '';
}
}
async getConfigs(scope: string): Promise<{ key: string; value: string }[]> {

View file

@ -1474,8 +1474,9 @@ export class Repository implements Disposable {
// Git config
try {
const mergeBase = await this.getConfig(branchMergeBaseConfigKey);
if (mergeBase) {
return await this.getBranch(mergeBase);
if (mergeBase !== '') {
const mergeBaseBranch = await this.getBranch(mergeBase);
return mergeBaseBranch;
}
} catch (err) { }