Skip to content

Landing: keep ignored local files safe in a fast-forward and in a local squash - #540

Closed
bompus wants to merge 1 commit into
mainfrom
fix/landing-keep-ignored-files-v2
Closed

bompus wants to merge 1 commit into
mainfrom
fix/landing-keep-ignored-files-v2

Conversation

@bompus

@bompus bompus commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

This replaces #537, whose review bot reached its six-review limit. The commit here is #537's final head, one commit on main; the design changed during #537's review, so the bot has not seen it from the start.

The landing helper's fast-forward could silently replace an ignored local file (for example a .env) when the incoming commit adds a tracked file at the same path, because its clean-tree check does not look at ignored files.

  • Fast-forward: verify-landed.sh --ff and the direct git merge --ff-only commands in the core landing rule and the landing and squash-landing references now pass --no-overwrite-ignore. The checkout is skipped with fast-forward refused and exit 3, and the file is untouched.
  • Local squash: --no-overwrite-ignore does not protect git merge --squash of a diverged branch (reproduced on Git 2.56.0: the three-way merge replaces the ignored file and exits 0). The squash reference now uses skills/hr-pr-followup/scripts/squash-land.sh <branch> "<message>". It builds the squash in a throwaway worktree of HEAD, which holds none of the checkout's ignored files, with a normal git merge --squash and git commit (so the repository's commit hooks run; a rejecting hook exits 1 and changes nothing), and applies the commit with git merge --ff-only --no-overwrite-ignore. Git refuses that at the moment it writes when it would replace an ignored or untracked local file, so there is no scan to get wrong and no gap to race. Exit 1: refused, nothing changed; exit 2: usage error, no commit in HEAD, or a conflict.

Verified by hand in scratch repositories: the ff-only form refuses an ignored file at the same path, an ignored file or symlink where a directory is needed, and a tracked directory turned into a file with an ignored file inside.

Proof: bun run check passes; the node tests pass, and the skill tests also pass with no global Git config. squash-land.test.js uses real diverged branches: the squash itself, an ignored file, an untracked file, a file or symlink where a directory is needed, a directory turned into a file with ignored files inside, a subdirectory, a conflict, a branch that adds nothing, a rejecting hook, a message-rewriting hook and a checkout with no commit. An earlier version scanned for collisions first; the review found a series of ways it could miss one, so it was replaced by letting Git refuse the write. An independent DeepSeek review found no way to replace the contents of an ignored, untracked or modified local file. It did find, and this head fixes, three things: a merge.ff setting turned every run into a false "conflict"; hooks in an ignored core.hooksPath directory were skipped in the throwaway worktree; and a failed worktree checkout exited outside the documented codes. It also showed that the final step is not atomic (a held ref lock or an unwritable directory can leave files updated while the branch does not move), so the script and the reference no longer claim "nothing changed" for that step and tell the caller to check git status.

@bompus bompus added the author:anthropic Pull request written by a anthropic model label Nov 3, 2026

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 10 finding(s).

Comment thread rules/references/squash-landing.md Resolved
Comment thread rules/references/squash-landing.md Resolved
@bompus
bompus force-pushed the fix/landing-keep-ignored-files-v2 branch 2 times, most recently from 482e438 to 9219f67 Compare November 3, 2026 01:46

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 6 finding(s).

@bompus
bompus force-pushed the fix/landing-keep-ignored-files-v2 branch from 9219f67 to 4553f3e Compare November 3, 2026 02:04

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 1 finding(s).

Review 3: only high findings and above are posted from here on.

@bompus
bompus force-pushed the fix/landing-keep-ignored-files-v2 branch 2 times, most recently from 724bef4 to 38ee6ba Compare November 3, 2026 02:19

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 1 finding(s).

Review 4: only high findings and above are posted from here on.

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 1 finding(s).

Review 5: only high findings and above are posted from here on.

@bompus
bompus force-pushed the fix/landing-keep-ignored-files-v2 branch from 38ee6ba to 6d3f1e5 Compare November 3, 2026 02:34

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review (GPT-6.1 Terra, max reasoning): 1 finding(s).

Review 6: only high findings and above are posted from here on.

@bompus
bompus force-pushed the fix/landing-keep-ignored-files-v2 branch from 6d3f1e5 to a1b7bad Compare November 3, 2026 04:13

@bompus-ai-review bompus-ai-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bompus AI Review limit: this pull request has had 6 reviews, so no more will be posted. Findings above that are still open stay open. A maintainer can still review by hand.

@bompus
bompus force-pushed the fix/landing-keep-ignored-files-v2 branch 6 times, most recently from e5bc053 to 6316c39 Compare November 3, 2026 16:13
…al squash

The landing helper's fast-forward runs with --no-overwrite-ignore, so a landing no longer replaces an ignored local file (the checkout is skipped with fast-forward refused and exit 3), and the core landing rule and references give the same flag in their direct fast-forward commands. The option does not protect a squash of a diverged branch, so the squash reference now uses scripts/squash-land.sh: it builds the squash commit from the merge result with git merge-tree and git commit-tree, leaving the checkout untouched, and applies it with git merge --ff-only --no-overwrite-ignore, which Git itself refuses when it would replace an ignored or untracked local file. Tests with real diverged branches cover the squash, an ignored file, an untracked file, a file or symlink where a directory is needed, a directory turned into a file, a subdirectory, a conflict, a branch that adds nothing and a checkout with no commit.
@bompus
bompus force-pushed the fix/landing-keep-ignored-files-v2 branch from 6316c39 to e946f70 Compare November 3, 2026 16:29
@bompus

bompus commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Closed under the owner's 2026-11-03 rule (Question 153, option 153b): the fourth independent Sol read of this helper found one more data-loss case (an awk failure on PATH still counted as 'no gitlink'; every git failure was already fail-closed). The branch fix/landing-keep-ignored-files-v2 at e946f70 is kept, with a 14-line fix described in the review, and the old landing text stays. Reopening needs the owner's say. Reads: 1 four findings (one high), 2 four (one high), 3 one data-loss plus two fail-safe, 4 (this) one data-loss.

@bompus bompus closed this Nov 3, 2026
@bompus bompus mentioned this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:anthropic Pull request written by a anthropic model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant