Merge commit 'refs/pull/58174/head' of github.com:Microsoft/vscode into pr/58174

This commit is contained in:
Joao Moreno
2018-09-13 17:20:52 +02:00
2 changed files with 24 additions and 10 deletions

View File

@@ -998,20 +998,26 @@ export class Repository {
throw commitErr;
}
try {
await this.run(['config', '--get-all', 'user.name']);
} catch (err) {
err.gitErrorCode = GitErrorCodes.NoUserNameConfigured;
throw err;
}
let userName, userEmail;
try {
await this.run(['config', '--get-all', 'user.email']);
} catch (err) {
err.gitErrorCode = GitErrorCodes.NoUserEmailConfigured;
throw err;
const nameResult = await this.run(['config', '--get-all', 'user.name']);
userName = nameResult.stdout.split('\n').filter(l => !!l).pop();
} catch (err) { }
try {
const emailResult = await this.run(['config', '--get-all', 'user.email']);
userEmail = emailResult.stdout.split('\n').filter(l => !!l).pop();
} catch (err) { }
if (userName && userEmail) {
throw commitErr;
}
commitErr.gitErrorCode = !userName ? GitErrorCodes.NoUserNameConfigured : GitErrorCodes.NoUserEmailConfigured;
commitErr.userName = userName;
commitErr.userEmail = userEmail;
throw commitErr;
}