jettypod 4.4.18 → 4.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/worktree-manager.js +13 -25
- package/package.json +1 -1
package/lib/worktree-manager.js
CHANGED
|
@@ -231,40 +231,28 @@ async function createWorktree(workItem, options = {}) {
|
|
|
231
231
|
throw new Error(`Failed to create .jettypod symlink: ${symlinkErr.message}`);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
// Step 4.5: Add .jettypod to worktree's
|
|
234
|
+
// Step 4.5: Add .jettypod to worktree's .gitignore
|
|
235
|
+
// NOTE: git's info/exclude does NOT work for worktrees - only .gitignore works
|
|
235
236
|
// This prevents the symlink from being committed when merging the worktree branch
|
|
236
237
|
try {
|
|
237
|
-
|
|
238
|
-
const gitDirOutput = execSync('git rev-parse --git-dir', {
|
|
239
|
-
cwd: worktreePath,
|
|
240
|
-
encoding: 'utf8'
|
|
241
|
-
}).trim();
|
|
242
|
-
|
|
243
|
-
// gitDirOutput is already absolute for worktrees (e.g., /path/to/.git/worktrees/name)
|
|
244
|
-
const excludePath = path.join(gitDirOutput, 'info', 'exclude');
|
|
245
|
-
|
|
246
|
-
// Ensure the info directory exists
|
|
247
|
-
const infoDir = path.dirname(excludePath);
|
|
248
|
-
if (!fs.existsSync(infoDir)) {
|
|
249
|
-
fs.mkdirSync(infoDir, { recursive: true });
|
|
250
|
-
}
|
|
238
|
+
const gitignorePath = path.join(worktreePath, '.gitignore');
|
|
251
239
|
|
|
252
|
-
// Read existing
|
|
253
|
-
let
|
|
254
|
-
if (fs.existsSync(
|
|
255
|
-
|
|
240
|
+
// Read existing .gitignore or create empty
|
|
241
|
+
let gitignoreContent = '';
|
|
242
|
+
if (fs.existsSync(gitignorePath)) {
|
|
243
|
+
gitignoreContent = fs.readFileSync(gitignorePath, 'utf8');
|
|
256
244
|
}
|
|
257
245
|
|
|
258
|
-
// Add .jettypod if not already
|
|
259
|
-
if (!
|
|
260
|
-
const newEntry =
|
|
246
|
+
// Add .jettypod if not already in .gitignore
|
|
247
|
+
if (!gitignoreContent.includes('.jettypod')) {
|
|
248
|
+
const newEntry = gitignoreContent.endsWith('\n') || gitignoreContent === ''
|
|
261
249
|
? '.jettypod\n'
|
|
262
250
|
: '\n.jettypod\n';
|
|
263
|
-
fs.writeFileSync(
|
|
251
|
+
fs.writeFileSync(gitignorePath, gitignoreContent + newEntry);
|
|
264
252
|
}
|
|
265
|
-
} catch (
|
|
253
|
+
} catch (gitignoreErr) {
|
|
266
254
|
// Non-fatal - log warning but continue
|
|
267
|
-
console.warn(`Warning: Could not add .jettypod to
|
|
255
|
+
console.warn(`Warning: Could not add .jettypod to .gitignore: ${gitignoreErr.message}`);
|
|
268
256
|
}
|
|
269
257
|
|
|
270
258
|
// Step 5: Symlink .env files from main repo
|