Skip to content

Commit 8ea58df

Browse files
committed
more logs
1 parent 6c8c084 commit 8ea58df

File tree

1 file changed

+69
-2
lines changed

1 file changed

+69
-2
lines changed

src/test/integration/git.test.ts

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,31 +170,61 @@ const makeFileChanges = async (
170170
changegroup === "with-unchanged-symlink" ||
171171
changegroup === "with-changed-symlink"
172172
) {
173+
console.log("DEBUG: makeFileChanges - Creating symlink directory");
173174
await fs.promises.mkdir(path.join(repoDirectory, "some-dir"), {
174175
recursive: true,
175176
});
177+
console.log("DEBUG: makeFileChanges - Creating symlink");
176178
await fs.promises.symlink(
177179
"../README.md",
178180
path.join(repoDirectory, "some-dir", "nested"),
179181
);
182+
// Verify symlink was created
183+
const target = await fs.promises.readlink(
184+
path.join(repoDirectory, "some-dir", "nested"),
185+
);
186+
console.log("DEBUG: makeFileChanges - Symlink created, target:", target);
187+
180188
// Use native git CLI for symlink commit - isomorphic-git has inconsistent
181189
// oid calculation between git.add/commit and WORKDIR walker for symlinks
190+
console.log("DEBUG: makeFileChanges - Running git add");
182191
await new Promise<void>((resolve, reject) => {
183192
execFile(
184193
"git",
185194
["add", "some-dir/nested"],
186195
{ cwd: repoDirectory },
187-
(error) => (error ? reject(error) : resolve()),
196+
(error, stdout, stderr) => {
197+
console.log("DEBUG: git add stdout:", stdout);
198+
console.log("DEBUG: git add stderr:", stderr);
199+
if (error) {
200+
console.log("DEBUG: git add error:", error);
201+
reject(error);
202+
} else {
203+
resolve();
204+
}
205+
},
188206
);
189207
});
208+
209+
console.log("DEBUG: makeFileChanges - Running git commit");
190210
await new Promise<void>((resolve, reject) => {
191211
execFile(
192212
"git",
193213
["commit", "-m", "Add symlink"],
194214
{ cwd: repoDirectory },
195-
(error) => (error ? reject(error) : resolve()),
215+
(error, stdout, stderr) => {
216+
console.log("DEBUG: git commit stdout:", stdout);
217+
console.log("DEBUG: git commit stderr:", stderr);
218+
if (error) {
219+
console.log("DEBUG: git commit error:", error);
220+
reject(error);
221+
} else {
222+
resolve();
223+
}
224+
},
196225
);
197226
});
227+
console.log("DEBUG: makeFileChanges - Symlink committed");
198228

199229
if (changegroup === "with-changed-symlink") {
200230
await fs.promises.rm(path.join(repoDirectory, "some-dir", "nested"));
@@ -368,18 +398,23 @@ describe("git", () => {
368398
const branch = `${TEST_BRANCH_PREFIX}-unchanged-symlink`;
369399
branches.push(branch);
370400

401+
console.log("DEBUG: Step 1 - Creating test directory");
371402
await fs.promises.mkdir(testDir, { recursive: true });
372403
const repoDirectory = path.join(testDir, `repo-unchanged-symlink`);
404+
console.log("DEBUG: repoDirectory:", repoDirectory);
373405

406+
console.log("DEBUG: Step 2 - Cloning repo from:", process.cwd());
374407
await new Promise<void>((resolve, reject) => {
375408
const p = execFile(
376409
"git",
377410
["clone", process.cwd(), `repo-unchanged-symlink`],
378411
{ cwd: testDir },
379412
(error) => {
380413
if (error) {
414+
console.log("DEBUG: Clone error:", error);
381415
reject(error);
382416
} else {
417+
console.log("DEBUG: Clone successful");
383418
resolve();
384419
}
385420
},
@@ -388,7 +423,39 @@ describe("git", () => {
388423
p.stderr?.pipe(process.stderr);
389424
});
390425

426+
// Check git status after clone
427+
console.log("DEBUG: Step 3 - Checking git status after clone");
428+
await new Promise<void>((resolve) => {
429+
execFile(
430+
"git",
431+
["status"],
432+
{ cwd: repoDirectory },
433+
(error, stdout, stderr) => {
434+
console.log("DEBUG: git status stdout:", stdout);
435+
console.log("DEBUG: git status stderr:", stderr);
436+
if (error) console.log("DEBUG: git status error:", error);
437+
resolve();
438+
},
439+
);
440+
});
441+
442+
// Check current branch
443+
await new Promise<void>((resolve) => {
444+
execFile(
445+
"git",
446+
["branch", "-a"],
447+
{ cwd: repoDirectory },
448+
(error, stdout) => {
449+
console.log("DEBUG: git branch -a stdout:", stdout);
450+
if (error) console.log("DEBUG: git branch error:", error);
451+
resolve();
452+
},
453+
);
454+
});
455+
456+
console.log("DEBUG: Step 4 - Calling makeFileChanges");
391457
await makeFileChanges(repoDirectory, "with-unchanged-symlink");
458+
console.log("DEBUG: Step 5 - makeFileChanges completed");
392459

393460
// DEBUG: Log symlink state before calling commitChangesFromRepo
394461
const headOid = (

0 commit comments

Comments
 (0)