| ... | @@ -1477,25 +1477,35 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* | ... | @@ -1477,25 +1477,35 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* |
| 1477 | if (branchResult === null) { | 1477 | if (branchResult === null) { |
| 1478 | return NON_REPOSITORY_REMOTE_STATUS_DETAILS; | 1478 | return NON_REPOSITORY_REMOTE_STATUS_DETAILS; |
| 1479 | } | 1479 | } |
| | 1480 | let branch: string | null; |
| 1480 | if (branchResult.exitCode !== 0) { | 1481 | if (branchResult.exitCode !== 0) { |
| 1481 | if (isNonRepositoryGitStderr(branchResult.stderr)) { | 1482 | if (isNonRepositoryGitStderr(branchResult.stderr)) { |
| 1482 | return NON_REPOSITORY_REMOTE_STATUS_DETAILS; | 1483 | return NON_REPOSITORY_REMOTE_STATUS_DETAILS; |
| 1483 | } | 1484 | } |
| 1484 | return yield* new GitCommandError({ | 1485 | if (!isUnbornHeadStderr(branchResult.stderr)) { |
| 1485 | ...gitCommandContext({ | 1486 | return yield* new GitCommandError({ |
| 1486 | operation: "GitVcsDriver.statusDetailsRemote.branch", | 1487 | ...gitCommandContext({ |
| 1487 | cwd, | 1488 | operation: "GitVcsDriver.statusDetailsRemote.branch", |
| 1488 | args: ["rev-parse", "--abbrev-ref", "HEAD"], | 1489 | cwd, |
| 1489 | }), | 1490 | args: ["rev-parse", "--abbrev-ref", "HEAD"], |
| 1490 | detail: "Git branch lookup failed.", | 1491 | }), |
| 1491 | exitCode: branchResult.exitCode, | 1492 | detail: "Git branch lookup failed.", |
| 1492 | stdoutLength: branchResult.stdout.length, | 1493 | exitCode: branchResult.exitCode, |
| 1493 | stderrLength: branchResult.stderr.length, | 1494 | stdoutLength: branchResult.stdout.length, |
| 1494 | }); | 1495 | stderrLength: branchResult.stderr.length, |
| 1495 | } | 1496 | }); |
| | 1497 | } |
| 1496 | | 1498 | |
| 1497 | const branchValue = branchResult.stdout.trim(); | 1499 | const branchValue = yield* runGitStdout( |
| 1498 | const branch = branchValue.length > 0 && branchValue !== "HEAD" ? branchValue : null; | 1500 | "GitVcsDriver.statusDetailsRemote.unbornBranch", |
| | 1501 | cwd, |
| | 1502 | ["symbolic-ref", "--quiet", "--short", "HEAD"], |
| | 1503 | ); |
| | 1504 | branch = branchValue.trim() || null; |
| | 1505 | } else { |
| | 1506 | const branchValue = branchResult.stdout.trim(); |
| | 1507 | branch = branchValue.length > 0 && branchValue !== "HEAD" ? branchValue : null; |
| | 1508 | } |
| 1499 | const upstream = yield* resolveCurrentUpstream(cwd); | 1509 | const upstream = yield* resolveCurrentUpstream(cwd); |
| 1500 | const upstreamRef = upstream?.upstreamRef ?? null; | 1510 | const upstreamRef = upstream?.upstreamRef ?? null; |
| 1501 | let aheadCount = 0; | 1511 | let aheadCount = 0; |