fix(#2537): extract offer_next step to references/ (~3.3KB headroom restored) (#2642)

* fix(#2537): extract offer_next step to references/ (~3.3KB headroom restored)

* chore(#2537): backfill changeset pr to 2642
This commit is contained in:
Tom Boucher
2026-07-25 05:30:20 -04:00
committed by GitHub
parent e4dd0cbdd5
commit 6ee4349272
46 changed files with 184 additions and 164 deletions

View File

@@ -211,9 +211,11 @@ describe('commit --files: pathspec honors declared scope (#2112)', () => {
);
});
test('#2523: out-of-repo --files path is rejected loudly (path_outside_repo), no index pollution', (t) => {
// An absolute path resolving OUTSIDE the project root must fail loudly, not
// silently skip and not pollute the index via a failed git add (#2523).
test('#2523: out-of-repo --files path is rejected by git (nothing_to_commit), no index pollution', (t) => {
// An absolute path resolving OUTSIDE the project root: git add rejects it → the
// gated stagedPaths.push (on git-add exitCode) skips it → nothing_to_commit. No
// index pollution (#2523). Not "path_outside_repo" (that guard was removed for
// macOS symlink compatibility — the gated push + git's own rejection suffice).
const outsideDir = path.join(tmpDir, '..', `gsd-2523-outside-${process.pid}-${Date.now()}`);
fs.mkdirSync(outsideDir, { recursive: true });
t.after(() => cleanup(outsideDir));
@@ -226,12 +228,12 @@ describe('commit --files: pathspec honors declared scope (#2112)', () => {
);
const parsed = JSON.parse(res.output);
assert.strictEqual(parsed.committed, false, 'out-of-repo path must not commit');
assert.strictEqual(parsed.reason, 'path_outside_repo', `out-of-repo path must fail loudly: ${res.output}`);
assert.strictEqual(parsed.reason, 'nothing_to_commit', `out-of-repo: git rejects → nothing_to_commit: ${res.output}`);
// No new commit created (still at the single initial commit).
const logCount = execSync('git rev-list --count HEAD', { cwd: tmpDir, encoding: 'utf-8' }).trim();
assert.strictEqual(logCount, '1', 'no new commit must be created for an out-of-repo path');
// Index stays clean (no pollution from a failed git add).
// Index stays clean (git add failed → nothing staged).
const status = execSync('git status --porcelain', { cwd: tmpDir, encoding: 'utf-8' }).trim();
assert.strictEqual(status, '', `index must be clean (no pollution): ${status}`);
});