Browse Source

Fixes blank branch name before any commits

main
Eric Amodio 4 years ago
parent
commit
52ddefdce4
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/git/git.ts

+ 6
- 1
src/git/git.ts View File

@ -1065,7 +1065,12 @@ export namespace Git {
} catch (ex) {
const msg: string = ex?.toString() ?? '';
if (GitErrors.badRevision.test(msg) || GitWarnings.noUpstream.test(msg)) {
return [ex.stdout, undefined];
if (ex.stdout != null && ex.stdout.length !== 0) {
return [ex.stdout, undefined];
}
const defaultBranch = await config__get('init.defaultBranch', repoPath, { local: true });
return [defaultBranch ?? 'main', undefined];
}
if (GitWarnings.headNotABranch.test(msg)) {

Loading…
Cancel
Save