| @@ -448,7 +448,7 @@ const createTrace2Monitor = Effect.fn("createTrace2Monitor")(function* ( · 447 unmodified lines |
| 448 | | 448 | |
| 449 | if (event === "child_exit") { | 449 | if (event === "child_exit") { |
| 450 | hookStartByChildKey.delete(childKey); | 450 | hookStartByChildKey.delete(childKey); |
| 451 | const code = traceRecord.success.code; | 451 | const code = traceRecord.success.exitCode; |
| 452 | const exitCode = typeof code === "number" && Number.isInteger(code) ? code : null; | 452 | const exitCode = typeof code === "number" && Number.isInteger(code) ? code : null; |
| 453 | const now = yield* DateTime.now; | 453 | const now = yield* DateTime.now; |
| 454 | const durationMs = started | 454 | const durationMs = started |
| @@ -666,7 +666,6 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 211 unmodified lines |
| 666 | input.progress?.onStderrLine, | 666 | input.progress?.onStderrLine, |
| 667 | ), | 667 | ), |
| 668 | child.exitCode.pipe( | 668 | child.exitCode.pipe( |
| 669 | Effect.map((value) => Number(value)), | | |
| 670 | Effect.mapError(toGitCommandError(commandInput, "failed to report exit code.")), | 669 | Effect.mapError(toGitCommandError(commandInput, "failed to report exit code.")), |
| 671 | ), | 670 | ), |
| 672 | input.stdin === undefined | 671 | input.stdin === undefined |
| @@ -693,7 +692,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 20 unmodified lines |
| 693 | } | 692 | } |
| 694 | | 693 | |
| 695 | return { | 694 | return { |
| 696 | code: exitCode, | 695 | exitCode, |
| 697 | stdout: stdout.text, | 696 | stdout: stdout.text, |
| 698 | stderr: stderr.text, | 697 | stderr: stderr.text, |
| 699 | stdoutTruncated: stdout.truncated, | 698 | stdoutTruncated: stdout.truncated, |
| @@ -761,7 +760,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 61 unmodified lines |
| 761 | ...(options.progress ? { progress: options.progress } : {}), | 760 | ...(options.progress ? { progress: options.progress } : {}), |
| 762 | }).pipe( | 761 | }).pipe( |
| 763 | Effect.flatMap((result) => { | 762 | Effect.flatMap((result) => { |
| 764 | if (options.allowNonZeroExit || result.code === 0) { | 763 | if (options.allowNonZeroExit || result.exitCode === 0) { |
| 765 | return Effect.succeed(result); | 764 | return Effect.succeed(result); |
| 766 | } | 765 | } |
| 767 | const stderr = result.stderr.trim(); | 766 | const stderr = result.stderr.trim(); |
| @@ -778,7 +777,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 10 unmodified lines |
| 778 | operation, | 777 | operation, |
| 779 | cwd, | 778 | cwd, |
| 780 | args, | 779 | args, |
| 781 | `${commandLabel(args)} failed: code=${result.code ?? "null"}`, | 780 | `${commandLabel(args)} failed: code=${result.exitCode ?? "null"}`, |
| 782 | ), | 781 | ), |
| 783 | ); | 782 | ); |
| 784 | }), | 783 | }), |
| @@ -823,7 +822,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 38 unmodified lines |
| 823 | allowNonZeroExit: true, | 822 | allowNonZeroExit: true, |
| 824 | timeoutMs: 5_000, | 823 | timeoutMs: 5_000, |
| 825 | }, | 824 | }, |
| 826 | ).pipe(Effect.map((result) => result.code === 0)); | 825 | ).pipe(Effect.map((result) => result.exitCode === 0)); |
| 827 | | 826 | |
| 828 | const resolveAvailableBranchName = Effect.fn("resolveAvailableBranchName")(function* ( | 827 | const resolveAvailableBranchName = Effect.fn("resolveAvailableBranchName")(function* ( |
| 829 | cwd: string, | 828 | cwd: string, |
| @@ -939,7 +938,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 109 unmodified lines |
| 939 | { allowNonZeroExit: true }, | 938 | { allowNonZeroExit: true }, |
| 940 | ).pipe( | 939 | ).pipe( |
| 941 | Effect.map((result) => { | 940 | Effect.map((result) => { |
| 942 | if (result.code !== 0) { | 941 | if (result.exitCode !== 0) { |
| 943 | return null; | 942 | return null; |
| 944 | } | 943 | } |
| 945 | return parseDefaultBranchFromRemoteHeadRef(result.stdout, remoteName); | 944 | return parseDefaultBranchFromRemoteHeadRef(result.stdout, remoteName); |
| @@ -958,12 +957,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 12 unmodified lines |
| 958 | { | 957 | { |
| 959 | allowNonZeroExit: true, | 958 | allowNonZeroExit: true, |
| 960 | }, | 959 | }, |
| 961 | ).pipe(Effect.map((result) => result.code === 0)); | 960 | ).pipe(Effect.map((result) => result.exitCode === 0)); |
| 962 | | 961 | |
| 963 | const originRemoteExists = (cwd: string): Effect.Effect<boolean, GitCommandError> => | 962 | const originRemoteExists = (cwd: string): Effect.Effect<boolean, GitCommandError> => |
| 964 | executeGit("GitVcsDriver.originRemoteExists", cwd, ["remote", "get-url", "origin"], { | 963 | executeGit("GitVcsDriver.originRemoteExists", cwd, ["remote", "get-url", "origin"], { |
| 965 | allowNonZeroExit: true, | 964 | allowNonZeroExit: true, |
| 966 | }).pipe(Effect.map((result) => result.code === 0)); | 965 | }).pipe(Effect.map((result) => result.exitCode === 0)); |
| 967 | | 966 | |
| 968 | const listRemoteNames = (cwd: string): Effect.Effect<ReadonlyArray<string>, GitCommandError> => | 967 | const listRemoteNames = (cwd: string): Effect.Effect<ReadonlyArray<string>, GitCommandError> => |
| 969 | runGitStdout("GitVcsDriver.listRemoteNames", cwd, ["remote"]).pipe( | 968 | runGitStdout("GitVcsDriver.listRemoteNames", cwd, ["remote"]).pipe( |
| @@ -1115,7 +1114,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 145 unmodified lines |
| 1115 | ["rev-list", "--count", `${baseRef}..HEAD`], | 1114 | ["rev-list", "--count", `${baseRef}..HEAD`], |
| 1116 | { allowNonZeroExit: true }, | 1115 | { allowNonZeroExit: true }, |
| 1117 | ); | 1116 | ); |
| 1118 | if (result.code !== 0) { | 1117 | if (result.exitCode !== 0) { |
| 1119 | return 0; | 1118 | return 0; |
| 1120 | } | 1119 | } |
| 1121 | | 1120 | |
| @@ -1140,7 +1139,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 18 unmodified lines |
| 1140 | ); | 1139 | ); |
| 1141 | | 1140 | |
| 1142 | const branchLastCommit = new Map<string, number>(); | 1141 | const branchLastCommit = new Map<string, number>(); |
| 1143 | if (branchRecency.code !== 0) { | 1142 | if (branchRecency.exitCode !== 0) { |
| 1144 | return branchLastCommit; | 1143 | return branchLastCommit; |
| 1145 | } | 1144 | } |
| 1146 | | 1145 | |
| @@ -1173,7 +1172,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 26 unmodified lines |
| 1173 | return NON_REPOSITORY_STATUS_DETAILS; | 1172 | return NON_REPOSITORY_STATUS_DETAILS; |
| 1174 | } | 1173 | } |
| 1175 | | 1174 | |
| 1176 | if (statusResult.code !== 0) { | 1175 | if (statusResult.exitCode !== 0) { |
| 1177 | const stderr = statusResult.stderr.trim(); | 1176 | const stderr = statusResult.stderr.trim(); |
| 1178 | return yield* createGitCommandError( | 1177 | return yield* createGitCommandError( |
| 1179 | "GitVcsDriver.statusDetails.status", | 1178 | "GitVcsDriver.statusDetails.status", |
| @@ -1206,7 +1205,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 26 unmodified lines |
| 1206 | ); | 1205 | ); |
| 1207 | const statusStdout = statusResult.stdout; | 1206 | const statusStdout = statusResult.stdout; |
| 1208 | const defaultBranch = | 1207 | const defaultBranch = |
| 1209 | defaultRefResult.code === 0 | 1208 | defaultRefResult.exitCode === 0 |
| 1210 | ? defaultRefResult.stdout.trim().replace(/^refs\/remotes\/origin\//, "") | 1209 | ? defaultRefResult.stdout.trim().replace(/^refs\/remotes\/origin\//, "") |
| 1211 | : null; | 1210 | : null; |
| 1212 | | 1211 | |
| @@ -1614,7 +1613,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 401 unmodified lines |
| 1614 | ).pipe( | 1613 | ).pipe( |
| 1615 | Effect.catchIf(isMissingGitCwdError, () => | 1614 | Effect.catchIf(isMissingGitCwdError, () => |
| 1616 | Effect.succeed({ | 1615 | Effect.succeed({ |
| 1617 | code: 128, | 1616 | exitCode: ChildProcessSpawner.ExitCode(128), |
| 1618 | stdout: "", | 1617 | stdout: "", |
| 1619 | stderr: "fatal: not a git repository", | 1618 | stderr: "fatal: not a git repository", |
| 1620 | stdoutTruncated: false, | 1619 | stdoutTruncated: false, |
| @@ -1623,7 +1622,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 2 unmodified lines |
| 1623 | ), | 1622 | ), |
| 1624 | ); | 1623 | ); |
| 1625 | | 1624 | |
| 1626 | if (localBranchResult.code !== 0) { | 1625 | if (localBranchResult.exitCode !== 0) { |
| 1627 | const stderr = localBranchResult.stderr.trim(); | 1626 | const stderr = localBranchResult.stderr.trim(); |
| 1628 | if (stderr.toLowerCase().includes("not a git repository")) { | 1627 | if (stderr.toLowerCase().includes("not a git repository")) { |
| 1629 | return { | 1628 | return { |
| @@ -1654,7 +1653,15 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 24 unmodified lines |
| 1654 | Effect.catch((error) => | 1653 | Effect.catch((error) => |
| 1655 | Effect.logWarning( | 1654 | Effect.logWarning( |
| 1656 | `GitVcsDriver.listRefs: remote refName lookup failed for ${input.cwd}: ${error.message}. Falling back to an empty remote refName list.`, | 1655 | `GitVcsDriver.listRefs: remote refName lookup failed for ${input.cwd}: ${error.message}. Falling back to an empty remote refName list.`, |
| 1657 | ).pipe(Effect.as({ code: 1, stdout: "", stderr: "" })), | 1656 | ).pipe( |
| | 1657 | Effect.as({ |
| | 1658 | exitCode: ChildProcessSpawner.ExitCode(1), |
| | 1659 | stdout: "", |
| | 1660 | stderr: "", |
| | 1661 | stdoutTruncated: false, |
| | 1662 | stderrTruncated: false, |
| | 1663 | } satisfies ExecuteGitResult), |
| | 1664 | ), |
| 1658 | ), | 1665 | ), |
| 1659 | ); | 1666 | ); |
| 1660 | | 1667 | |
| @@ -1670,7 +1677,15 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 9 unmodified lines |
| 1670 | Effect.catch((error) => | 1677 | Effect.catch((error) => |
| 1671 | Effect.logWarning( | 1678 | Effect.logWarning( |
| 1672 | `GitVcsDriver.listRefs: remote name lookup failed for ${input.cwd}: ${error.message}. Falling back to an empty remote name list.`, | 1679 | `GitVcsDriver.listRefs: remote name lookup failed for ${input.cwd}: ${error.message}. Falling back to an empty remote name list.`, |
| 1673 | ).pipe(Effect.as({ code: 1, stdout: "", stderr: "" })), | 1680 | ).pipe( |
| | 1681 | Effect.as({ |
| | 1682 | exitCode: ChildProcessSpawner.ExitCode(1), |
| | 1683 | stdout: "", |
| | 1684 | stderr: "", |
| | 1685 | stdoutTruncated: false, |
| | 1686 | stderrTruncated: false, |
| | 1687 | } satisfies ExecuteGitResult), |
| | 1688 | ), |
| 1674 | ), | 1689 | ), |
| 1675 | ); | 1690 | ); |
| 1676 | | 1691 | |
| @@ -1703,25 +1718,25 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 26 unmodified lines |
| 1703 | ); | 1718 | ); |
| 1704 | | 1719 | |
| 1705 | const remoteNames = | 1720 | const remoteNames = |
| 1706 | remoteNamesResult.code === 0 ? parseRemoteNames(remoteNamesResult.stdout) : []; | 1721 | remoteNamesResult.exitCode === 0 ? parseRemoteNames(remoteNamesResult.stdout) : []; |
| 1707 | if (remoteBranchResult.code !== 0 && remoteBranchResult.stderr.trim().length > 0) { | 1722 | if (remoteBranchResult.exitCode !== 0 && remoteBranchResult.stderr.trim().length > 0) { |
| 1708 | yield* Effect.logWarning( | 1723 | yield* Effect.logWarning( |
| 1709 | `GitVcsDriver.listRefs: remote refName lookup returned code ${remoteBranchResult.code} for ${input.cwd}: ${remoteBranchResult.stderr.trim()}. Falling back to an empty remote refName list.`, | 1724 | `GitVcsDriver.listRefs: remote refName lookup returned code ${remoteBranchResult.exitCode} for ${input.cwd}: ${remoteBranchResult.stderr.trim()}. Falling back to an empty remote refName list.`, |
| 1710 | ); | 1725 | ); |
| 1711 | } | 1726 | } |
| 1712 | if (remoteNamesResult.code !== 0 && remoteNamesResult.stderr.trim().length > 0) { | 1727 | if (remoteNamesResult.exitCode !== 0 && remoteNamesResult.stderr.trim().length > 0) { |
| 1713 | yield* Effect.logWarning( | 1728 | yield* Effect.logWarning( |
| 1714 | `GitVcsDriver.listRefs: remote name lookup returned code ${remoteNamesResult.code} for ${input.cwd}: ${remoteNamesResult.stderr.trim()}. Falling back to an empty remote name list.`, | 1729 | `GitVcsDriver.listRefs: remote name lookup returned code ${remoteNamesResult.exitCode} for ${input.cwd}: ${remoteNamesResult.stderr.trim()}. Falling back to an empty remote name list.`, |
| 1715 | ); | 1730 | ); |
| 1716 | } | 1731 | } |
| 1717 | | 1732 | |
| 1718 | const defaultBranch = | 1733 | const defaultBranch = |
| 1719 | defaultRef.code === 0 | 1734 | defaultRef.exitCode === 0 |
| 1720 | ? defaultRef.stdout.trim().replace(/^refs\/remotes\/origin\//, "") | 1735 | ? defaultRef.stdout.trim().replace(/^refs\/remotes\/origin\//, "") |
| 1721 | : null; | 1736 | : null; |
| 1722 | | 1737 | |
| 1723 | const worktreeMap = new Map<string, string>(); | 1738 | const worktreeMap = new Map<string, string>(); |
| 1724 | if (worktreeList.code === 0) { | 1739 | if (worktreeList.exitCode === 0) { |
| 1725 | let currentPath: string | null = null; | 1740 | let currentPath: string | null = null; |
| 1726 | for (const line of worktreeList.stdout.split("\n")) { | 1741 | for (const line of worktreeList.stdout.split("\n")) { |
| 1727 | if (line.startsWith("worktree ")) { | 1742 | if (line.startsWith("worktree ")) { |
| @@ -1762,7 +1777,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 34 unmodified lines |
| 1762 | }); | 1777 | }); |
| 1763 | | 1778 | |
| 1764 | const remoteBranches = | 1779 | const remoteBranches = |
| 1765 | remoteBranchResult.code === 0 | 1780 | remoteBranchResult.exitCode === 0 |
| 1766 | ? remoteBranchResult.stdout | 1781 | ? remoteBranchResult.stdout |
| 1767 | .split("\n") | 1782 | .split("\n") |
| 1768 | .map(parseBranchLine) | 1783 | .map(parseBranchLine) |
| @@ -1943,7 +1958,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 174 unmodified lines |
| 1943 | timeoutMs: 5_000, | 1958 | timeoutMs: 5_000, |
| 1944 | allowNonZeroExit: true, | 1959 | allowNonZeroExit: true, |
| 1945 | }, | 1960 | }, |
| 1946 | ).pipe(Effect.map((result) => result.code === 0)), | 1961 | ).pipe(Effect.map((result) => result.exitCode === 0)), |
| 1947 | executeGit( | 1962 | executeGit( |
| 1948 | "GitVcsDriver.switchRef.remoteExists", | 1963 | "GitVcsDriver.switchRef.remoteExists", |
| 1949 | input.cwd, | 1964 | input.cwd, |
| @@ -1952,7 +1967,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 2 unmodified lines |
| 1952 | timeoutMs: 5_000, | 1967 | timeoutMs: 5_000, |
| 1953 | allowNonZeroExit: true, | 1968 | allowNonZeroExit: true, |
| 1954 | }, | 1969 | }, |
| 1955 | ).pipe(Effect.map((result) => result.code === 0)), | 1970 | ).pipe(Effect.map((result) => result.exitCode === 0)), |
| 1956 | ], | 1971 | ], |
| 1957 | { concurrency: "unbounded" }, | 1972 | { concurrency: "unbounded" }, |
| 1958 | ); | 1973 | ); |
| @@ -1968,7 +1983,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 9 unmodified lines |
| 1968 | }, | 1983 | }, |
| 1969 | ).pipe( | 1984 | ).pipe( |
| 1970 | Effect.map((result) => | 1985 | Effect.map((result) => |
| 1971 | result.code === 0 | 1986 | result.exitCode === 0 |
| 1972 | ? parseTrackingBranchByUpstreamRef(result.stdout, input.refName) | 1987 | ? parseTrackingBranchByUpstreamRef(result.stdout, input.refName) |
| 1973 | : null, | 1988 | : null, |
| 1974 | ), | 1989 | ), |
| @@ -1986,7 +2001,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* · 11 unmodified lines |
| 1986 | timeoutMs: 5_000, | 2001 | timeoutMs: 5_000, |
| 1987 | allowNonZeroExit: true, | 2002 | allowNonZeroExit: true, |
| 1988 | }, | 2003 | }, |
| 1989 | ).pipe(Effect.map((result) => result.code === 0)) | 2004 | ).pipe(Effect.map((result) => result.exitCode === 0)) |
| 1990 | : false; | 2005 | : false; |
| 1991 | | 2006 | |
| 1992 | const checkoutArgs = localInputExists | 2007 | const checkoutArgs = localInputExists |