mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Make git tests independent of init.defaultBranch
This commit is contained in:
@@ -783,7 +783,7 @@ function waitForSignal<T>(
|
||||
async () => {
|
||||
const cwd = tmpCwd();
|
||||
|
||||
execSync("git init", { cwd, stdio: "pipe" });
|
||||
execSync("git init -b main", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.email 'test@test.com'", {
|
||||
cwd,
|
||||
stdio: "pipe",
|
||||
|
||||
@@ -266,7 +266,7 @@ describe("daemon checkout ship loop", () => {
|
||||
initGitRepo(repoDir);
|
||||
|
||||
const remoteDir = path.join(repoDir, "remote.git");
|
||||
execSync(`git init --bare ${remoteDir}`, { stdio: "pipe" });
|
||||
execSync(`git init --bare -b main ${remoteDir}`, { stdio: "pipe" });
|
||||
execSync(`git remote add origin ${remoteDir}`, { cwd: repoDir, stdio: "pipe" });
|
||||
execSync("git push -u origin main", { cwd: repoDir, stdio: "pipe" });
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ describe("daemon E2E", () => {
|
||||
|
||||
// Initialize git repo with clean state
|
||||
const { execSync } = await import("child_process");
|
||||
execSync("git init", { cwd, stdio: "pipe" });
|
||||
execSync("git init -b main", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.email 'test@test.com'", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.name 'Test'", { cwd, stdio: "pipe" });
|
||||
|
||||
@@ -242,7 +242,7 @@ describe("daemon E2E", () => {
|
||||
|
||||
// Initialize git repo
|
||||
const { execSync } = await import("child_process");
|
||||
execSync("git init", { cwd, stdio: "pipe" });
|
||||
execSync("git init -b main", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.email 'test@test.com'", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.name 'Test'", { cwd, stdio: "pipe" });
|
||||
|
||||
@@ -293,7 +293,7 @@ describe("daemon E2E", () => {
|
||||
|
||||
// Initialize git repo with clean state
|
||||
const { execSync } = await import("child_process");
|
||||
execSync("git init", { cwd, stdio: "pipe" });
|
||||
execSync("git init -b main", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.email 'test@test.com'", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.name 'Test'", { cwd, stdio: "pipe" });
|
||||
|
||||
@@ -365,7 +365,7 @@ describe("daemon E2E", () => {
|
||||
const repoRoot = tmpCwd();
|
||||
|
||||
const { execSync } = await import("child_process");
|
||||
execSync("git init", { cwd: repoRoot, stdio: "pipe" });
|
||||
execSync("git init -b main", { cwd: repoRoot, stdio: "pipe" });
|
||||
execSync("git config user.email 'test@test.com'", {
|
||||
cwd: repoRoot,
|
||||
stdio: "pipe",
|
||||
@@ -439,7 +439,7 @@ describe("daemon E2E", () => {
|
||||
const repoRoot = tmpCwd();
|
||||
|
||||
const { execSync } = await import("child_process");
|
||||
execSync("git init", { cwd: repoRoot, stdio: "pipe" });
|
||||
execSync("git init -b main", { cwd: repoRoot, stdio: "pipe" });
|
||||
execSync("git config user.email 'test@test.com'", {
|
||||
cwd: repoRoot,
|
||||
stdio: "pipe",
|
||||
@@ -526,7 +526,7 @@ describe("daemon E2E", () => {
|
||||
const cwd = tmpCwd();
|
||||
|
||||
const { execSync } = await import("child_process");
|
||||
execSync("git init", { cwd, stdio: "pipe" });
|
||||
execSync("git init -b main", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.email 'test@test.com'", { cwd, stdio: "pipe" });
|
||||
execSync("git config user.name 'Test'", { cwd, stdio: "pipe" });
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ describe("checkout git utilities", () => {
|
||||
|
||||
it("exposes hasRemote when origin is configured", async () => {
|
||||
const remoteDir = join(tempDir, "remote.git");
|
||||
execSync(`git init --bare ${remoteDir}`);
|
||||
execSync(`git init --bare -b main ${remoteDir}`);
|
||||
execSync(`git remote add origin ${remoteDir}`, { cwd: repoDir });
|
||||
|
||||
const status = await getCheckoutStatus(repoDir);
|
||||
@@ -232,7 +232,7 @@ describe("checkout git utilities", () => {
|
||||
|
||||
it("merges from the most-ahead base ref (origin/main when it is ahead)", async () => {
|
||||
const remoteDir = join(tempDir, "remote.git");
|
||||
execSync(`git init --bare ${remoteDir}`);
|
||||
execSync(`git init --bare -b main ${remoteDir}`);
|
||||
execSync(`git remote add origin ${remoteDir}`, { cwd: repoDir });
|
||||
execSync("git push -u origin main", { cwd: repoDir });
|
||||
|
||||
@@ -262,7 +262,7 @@ describe("checkout git utilities", () => {
|
||||
|
||||
it("merges from the most-ahead base ref (local main when it is ahead)", async () => {
|
||||
const remoteDir = join(tempDir, "remote.git");
|
||||
execSync(`git init --bare ${remoteDir}`);
|
||||
execSync(`git init --bare -b main ${remoteDir}`);
|
||||
execSync(`git remote add origin ${remoteDir}`, { cwd: repoDir });
|
||||
execSync("git push -u origin main", { cwd: repoDir });
|
||||
|
||||
@@ -312,7 +312,7 @@ describe("checkout git utilities", () => {
|
||||
|
||||
it("pushes the current branch to origin", async () => {
|
||||
const remoteDir = join(tempDir, "remote.git");
|
||||
execSync(`git init --bare ${remoteDir}`);
|
||||
execSync(`git init --bare -b main ${remoteDir}`);
|
||||
execSync(`git remote add origin ${remoteDir}`, { cwd: repoDir });
|
||||
execSync("git push -u origin main", { cwd: repoDir });
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("createWorktree", () => {
|
||||
|
||||
// Create a git repo with an initial commit
|
||||
execSync(`mkdir -p ${repoDir}`);
|
||||
execSync("git init", { cwd: repoDir });
|
||||
execSync("git init -b main", { cwd: repoDir });
|
||||
execSync("git config user.email 'test@test.com'", { cwd: repoDir });
|
||||
execSync("git config user.name 'Test'", { cwd: repoDir });
|
||||
execSync("echo 'hello' > file.txt", { cwd: repoDir });
|
||||
@@ -265,7 +265,7 @@ describe("paseo worktree manager", () => {
|
||||
paseoHome = join(tempDir, "paseo-home");
|
||||
|
||||
execSync(`mkdir -p ${repoDir}`);
|
||||
execSync("git init", { cwd: repoDir });
|
||||
execSync("git init -b main", { cwd: repoDir });
|
||||
execSync("git config user.email 'test@test.com'", { cwd: repoDir });
|
||||
execSync("git config user.name 'Test'", { cwd: repoDir });
|
||||
execSync("echo 'hello' > file.txt", { cwd: repoDir });
|
||||
|
||||
Reference in New Issue
Block a user