jettypod 4.4.17 → 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 -24
- package/package.json +1 -1
package/lib/worktree-manager.js
CHANGED
|
@@ -231,39 +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
|
-
const excludePath = path.join(worktreePath, gitDirOutput, 'info', 'exclude');
|
|
244
|
-
|
|
245
|
-
// Ensure the info directory exists
|
|
246
|
-
const infoDir = path.dirname(excludePath);
|
|
247
|
-
if (!fs.existsSync(infoDir)) {
|
|
248
|
-
fs.mkdirSync(infoDir, { recursive: true });
|
|
249
|
-
}
|
|
238
|
+
const gitignorePath = path.join(worktreePath, '.gitignore');
|
|
250
239
|
|
|
251
|
-
// Read existing
|
|
252
|
-
let
|
|
253
|
-
if (fs.existsSync(
|
|
254
|
-
|
|
240
|
+
// Read existing .gitignore or create empty
|
|
241
|
+
let gitignoreContent = '';
|
|
242
|
+
if (fs.existsSync(gitignorePath)) {
|
|
243
|
+
gitignoreContent = fs.readFileSync(gitignorePath, 'utf8');
|
|
255
244
|
}
|
|
256
245
|
|
|
257
|
-
// Add .jettypod if not already
|
|
258
|
-
if (!
|
|
259
|
-
const newEntry =
|
|
246
|
+
// Add .jettypod if not already in .gitignore
|
|
247
|
+
if (!gitignoreContent.includes('.jettypod')) {
|
|
248
|
+
const newEntry = gitignoreContent.endsWith('\n') || gitignoreContent === ''
|
|
260
249
|
? '.jettypod\n'
|
|
261
250
|
: '\n.jettypod\n';
|
|
262
|
-
fs.writeFileSync(
|
|
251
|
+
fs.writeFileSync(gitignorePath, gitignoreContent + newEntry);
|
|
263
252
|
}
|
|
264
|
-
} catch (
|
|
253
|
+
} catch (gitignoreErr) {
|
|
265
254
|
// Non-fatal - log warning but continue
|
|
266
|
-
console.warn(`Warning: Could not add .jettypod to
|
|
255
|
+
console.warn(`Warning: Could not add .jettypod to .gitignore: ${gitignoreErr.message}`);
|
|
267
256
|
}
|
|
268
257
|
|
|
269
258
|
// Step 5: Symlink .env files from main repo
|