@futurelastic/colab-handbook 1.13.0-rc.2 → 1.13.0-rc.3
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/package.json +1 -1
- package/tools/colab +13 -2
- package/tools/lib/scratch-dirs.js +13 -1
package/package.json
CHANGED
package/tools/colab
CHANGED
|
@@ -5677,7 +5677,8 @@ function cmdWorktreeNew(argv) {
|
|
|
5677
5677
|
|
|
5678
5678
|
// #488: the scratch dirs (plans, briefs) are hidden in the clone's shared info/exclude — one
|
|
5679
5679
|
// write covers the main checkout and every worktree, with no per-repo .gitignore diff.
|
|
5680
|
-
|
|
5680
|
+
// #527: and the worktree subdir itself, or trunk's `git add -A` stages this worktree as a gitlink.
|
|
5681
|
+
ensureScratchExcluded(repoAbs, config);
|
|
5681
5682
|
|
|
5682
5683
|
// 5. optional repo hook (machine-specific steps plug in here)
|
|
5683
5684
|
const hook = runHook(repoAbs, 'post-create', { wtPath, name, branch, ports: alloc.chosenPorts, trunk, base, issues });
|
|
@@ -8023,13 +8024,17 @@ function gitExcludePath(repoAbs) {
|
|
|
8023
8024
|
/**
|
|
8024
8025
|
* #488: append the scratch-dir exclude lines (scratch-dirs.js `excludeLines`) to the clone's shared
|
|
8025
8026
|
* info/exclude, idempotently. Best-effort: a failure warns and never blocks the caller.
|
|
8027
|
+
* #527: `config` given → the worktree subdir's line too (`worktreeExcludeLine`), so whatever creates
|
|
8028
|
+
* the default worktree dir also hides it — an adopted repo's `.gitignore` has never heard of it.
|
|
8026
8029
|
*/
|
|
8027
|
-
function ensureScratchExcluded(repoAbs) {
|
|
8030
|
+
function ensureScratchExcluded(repoAbs, config = null) {
|
|
8028
8031
|
const excludeFile = gitExcludePath(repoAbs);
|
|
8029
8032
|
if (!excludeFile) return [];
|
|
8030
8033
|
let before = null;
|
|
8031
8034
|
try { before = fs.readFileSync(excludeFile, 'utf8'); } catch (_) { /* absent */ }
|
|
8032
8035
|
const lines = scratchDirs.excludeLines();
|
|
8036
|
+
const wtLine = config ? scratchDirs.worktreeExcludeLine(worktreeSubdir(config)) : null;
|
|
8037
|
+
if (wtLine && !lines.includes(wtLine)) lines.push(wtLine);
|
|
8033
8038
|
const missing = localAdopt.missingExcludeLines(before, lines);
|
|
8034
8039
|
if (!missing.length) return [];
|
|
8035
8040
|
try {
|
|
@@ -8498,6 +8503,12 @@ async function cmdAdopt(argv) {
|
|
|
8498
8503
|
local = adoptLocalPrepare(repoAbs, opts);
|
|
8499
8504
|
if (local.exit !== undefined) return local.exit;
|
|
8500
8505
|
}
|
|
8506
|
+
// #527: a repo adopted before `worktree new` hid its own dir gets the same exclude lines here —
|
|
8507
|
+
// machine-local (info/exclude), idempotent, never a committed diff. --local already wrote them.
|
|
8508
|
+
if (!opts.local) {
|
|
8509
|
+
const hidden = ensureScratchExcluded(repoAbs, state.loadConfig());
|
|
8510
|
+
if (hidden.length && !opts.json) print(`✓ hid ${hidden.join(' ')} in .git/info/exclude (machine-local)`);
|
|
8511
|
+
}
|
|
8501
8512
|
const io = adoptIo(repoAbs);
|
|
8502
8513
|
const extra = adoptGitExtras(repoAbs, opts);
|
|
8503
8514
|
if (local) { extra.trunk = local.trunk; extra.trunkSource = 'local-integration'; }
|
|
@@ -81,6 +81,18 @@ function excludeLines(env = process.env) {
|
|
|
81
81
|
return out;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* #527: the root-anchored exclude line for the worktree subdir (`colab worktree new` creates
|
|
86
|
+
* worktrees INSIDE the clone, `.worktrees/` by default), or null when the configured subdir is
|
|
87
|
+
* absolute or climbs out of the repo. Deliberately NOT part of `excludeLines`: those are scratch
|
|
88
|
+
* (disposable, filtered out of the uncommitted-work gate by `isScratchPath`); a worktree is live
|
|
89
|
+
* work and must never be filtered — it only has to stay out of the main checkout's `git status`,
|
|
90
|
+
* where one habitual `git add -A` would otherwise commit it as an embedded-repo gitlink.
|
|
91
|
+
*/
|
|
92
|
+
function worktreeExcludeLine(worktreeSubdir) {
|
|
93
|
+
return anchoredLine(normalise(worktreeSubdir, '.worktrees'));
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
/**
|
|
85
97
|
* Is a repo-relative path (as `git status --porcelain` prints it) inside a scratch dir? Used to
|
|
86
98
|
* keep scratch out of the uncommitted-work gate: a plan or brief left in a worktree is disposable
|
|
@@ -102,5 +114,5 @@ function withoutScratch(porcelainText, env = process.env) {
|
|
|
102
114
|
module.exports = {
|
|
103
115
|
DEFAULT_PLANS_DIR, DEFAULT_BRIEFS_DIR, LEGACY_PLANS_DIR, LEGACY_BRIEFS_DIR,
|
|
104
116
|
plansDirSetting, briefsDirSetting, planWriteDir, briefsWriteDir, planReadDirs,
|
|
105
|
-
excludeLines, isScratchPath, withoutScratch,
|
|
117
|
+
excludeLines, worktreeExcludeLine, isScratchPath, withoutScratch,
|
|
106
118
|
};
|