Pass env to execFileSync git calls (#1151)

Bun's execFileSync without an explicit env option spawns with the process
startup environment, dropping runtime process.env mutations. The credential
helper reads GH_TOKEN which is set at runtime, so git fetch in the
restore-config path failed with empty password.

Fixes #1139

🏠 Remote-Dev: homespace
This commit is contained in:
Octavian Guzu 2026-04-02 21:52:02 +01:00 committed by GitHub
parent c95e735eb1
commit ba026a3e56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -118,7 +118,7 @@ export function validateBranchName(branchName: string): void {
* @param args - Git command arguments (e.g., ["checkout", "branch-name"])
*/
function execGit(args: string[]): void {
execFileSync("git", args, { stdio: "inherit" });
execFileSync("git", args, { stdio: "inherit", env: process.env });
}
export type BranchInfo = {

View File

@ -48,6 +48,7 @@ export function restoreConfigFromBase(baseBranch: string): void {
// caller sees a clean error.
execFileSync("git", ["fetch", "origin", baseBranch, "--depth=1"], {
stdio: "inherit",
env: process.env,
});
// Delete PR-controlled versions. If the restore below fails for a given path,