jettypod 4.2.9 → 4.2.11
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 +35 -0
- package/package.json +1 -1
package/lib/worktree-manager.js
CHANGED
|
@@ -217,6 +217,41 @@ async function createWorktree(workItem, options = {}) {
|
|
|
217
217
|
throw new Error(`Failed to create .jettypod symlink: ${symlinkErr.message}`);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
// Step 4.5: Add .jettypod to worktree's local gitignore
|
|
221
|
+
// This prevents the symlink from being committed when merging the worktree branch
|
|
222
|
+
try {
|
|
223
|
+
// Get the worktree's git directory
|
|
224
|
+
const gitDirOutput = execSync('git rev-parse --git-dir', {
|
|
225
|
+
cwd: worktreePath,
|
|
226
|
+
encoding: 'utf8'
|
|
227
|
+
}).trim();
|
|
228
|
+
|
|
229
|
+
const excludePath = path.join(worktreePath, gitDirOutput, 'info', 'exclude');
|
|
230
|
+
|
|
231
|
+
// Ensure the info directory exists
|
|
232
|
+
const infoDir = path.dirname(excludePath);
|
|
233
|
+
if (!fs.existsSync(infoDir)) {
|
|
234
|
+
fs.mkdirSync(infoDir, { recursive: true });
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Read existing exclude file or create empty
|
|
238
|
+
let excludeContent = '';
|
|
239
|
+
if (fs.existsSync(excludePath)) {
|
|
240
|
+
excludeContent = fs.readFileSync(excludePath, 'utf8');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Add .jettypod if not already excluded
|
|
244
|
+
if (!excludeContent.includes('.jettypod')) {
|
|
245
|
+
const newEntry = excludeContent.endsWith('\n') || excludeContent === ''
|
|
246
|
+
? '.jettypod\n'
|
|
247
|
+
: '\n.jettypod\n';
|
|
248
|
+
fs.writeFileSync(excludePath, excludeContent + newEntry);
|
|
249
|
+
}
|
|
250
|
+
} catch (excludeErr) {
|
|
251
|
+
// Non-fatal - log warning but continue
|
|
252
|
+
console.warn(`Warning: Could not add .jettypod to exclude: ${excludeErr.message}`);
|
|
253
|
+
}
|
|
254
|
+
|
|
220
255
|
// Step 5: Symlink .env files from main repo
|
|
221
256
|
// Environment files are typically gitignored, so worktrees don't get them
|
|
222
257
|
try {
|