Skip to content

Landing helper: refuse a fast-forward that would overwrite an ignored local file - #537

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

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

Conversation

@bompus

@bompus bompus commented Nov 2, 2026

Copy link
Copy Markdown
Owner

verify-landed.sh --ff fast-forwards a clean default checkout with git merge --ff-only. Git replaces an ignored untracked file silently when the incoming commit adds a tracked file at the same path, and the helper's clean-tree check (status --untracked-files=no) does not look at ignored files. A landing could therefore destroy a local .env-style file that exists nowhere else.

The merge now runs with --no-overwrite-ignore. The checkout is skipped with sync skipped at <path>: fast-forward refused: ... and exit 3, the same path an overwritten non-ignored untracked file already takes, and the ignored file is untouched.

Proof:

  • New test "a fast-forward that would overwrite an ignored local file is refused and skipped". Before the change it fails: the helper exits 0 and the file is replaced. After, it exits 3, HEAD is unchanged and the file content survives.
  • bun test skills/hr-pr-followup: 234 pass, 0 fail.
  • shellcheck and shfmt -i 2 -bn -ci --diff on the script: clean. oxfmt --check on the changed files: clean.
  • --no-overwrite-ignore also stops an ignored file with a leading space in its name, a dangling symlink and a pathspec-like name, which I checked by hand with git merge --ff-only --no-overwrite-ignore.

@bompus bompus added the author:anthropic Pull request written by a anthropic model label Nov 2, 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): 1 finding(s).

@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).

Comment thread rules/references/squash-landing.md Resolved

@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.

Comment thread rules/references/squash-landing.md Resolved
@bompus
bompus force-pushed the fix/landing-keep-ignored-files branch from ff9b485 to bf7a71a Compare November 3, 2026 00:08

@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): 4 finding(s).

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

Comment thread rules/references/squash-landing.md Resolved
@bompus
bompus force-pushed the fix/landing-keep-ignored-files branch 2 times, most recently from 49b6e67 to c6a5cf2 Compare November 3, 2026 00:40

@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): 3 finding(s).

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

Comment thread rules/references/squash-landing.md Resolved
@bompus
bompus force-pushed the fix/landing-keep-ignored-files branch from db52088 to 798f17b Compare November 3, 2026 00:54

@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 branch from 798f17b to b5dd3ee Compare November 3, 2026 01:10

@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.

…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 commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Replaced by #540: same single commit and tree, so the bot reviews the squash-land.sh design from round 1 (this PR reached the bot's six-review limit).

@bompus bompus closed this 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