Skip to content

gardener: clearer pull warnings after #1267 - #1311

Merged
scuttletoby merged 1 commit into
mainfrom
gardener-pull-minors
Nov 29, 2026
Merged

scuttletoby merged 1 commit into
mainfrom
gardener-pull-minors

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

Follow-up to #1267, from its round-2 code lens (both minors).

1. A refused pull names why. The gardener.root-not-pulled detail in report.md was git's last stderr line, which is Aborting for most refusals. It is now git's first error:/fatal: line plus the file names git lists under it, on one line (at most 5, then "and N more"; last line as before when there is no such line):

  • untracked file where the new commit adds one: error: The following untracked working tree files would be overwritten by merge: added.dat
  • left-over lock: error: Unable to create '…/.git/index.lock': File exists.
  • skip-worktree / assume-unchanged edit: error: Your local changes to the following files would be overwritten by merge: first.txt

git's words still go to the local report and log only. The issue gets the fixed text, and its fixed fix text now also lists "an untracked file where a new commit adds one".

2. Ignored files: README corrected, not refused. The README now says that git refuses a pull that would overwrite an untracked file, but an ignored file (.gitignore, .git/info/exclude) at a path the new commit adds is replaced, as a plain git pull does. I did not add a refusal. It would mean splitting the pull into fetch, a path check, and merge --ff-only @{u}, which reopens the pull path that rounds 1–2 checked (autostash flags, ff-only). It would also leave a warning that a person has to clear every time upstream starts tracking a generated file. A test pins the documented behaviour.

Tests (fork-kit/gardener/tests/run.test.py, class Pull). The first three failed before the fix, showing (Aborting) or the lock's "remove the file manually" line:

  • untracked clash: HEAD unchanged, the file keeps its content, exactly one warning, naming the file; the issue names neither the file nor git's words
  • left-over index.lock: named; a --force rerun with the lock still there gives the same one warning; once the lock is removed the next run pulls
  • skip-worktree edit: kept, and named
  • ignored file at an incoming path: the pull succeeds with no warning and the file is replaced (the README's claim)
  • _git_said unit test: name cap and the last-line fallback
  • new red-check mutation: going back to _last_line fails the untracked-clash test

Ran locally: checks, install and run tests all pass. In report.test.py, 9 Judge tests fail here because they serve a fake model on 127.0.0.1, which this machine blocks. They do not touch code this PR changes. CI runs them.

State question

  • Run again after a refused pull: nothing is kept between runs. The next day, or --force, runs status and pull from scratch, after the lock and done-day check. It gives the same one warning (now naming the cause) until the cause is gone, then it pulls. The index.lock test covers this.
  • Stale index.lock (for example a pull killed at the 5-minute limit during checkout): the root is not changed. Every run names the lock file until a person removes it; it is never removed automatically. Half-moved files from a killed checkout show up as dirty in the next status, so nothing is pulled over them.
  • Old config without pull: unchanged (off).

Fixes the two minors from the round-2 code lens on #1267.

🤖 Generated with Claude Code

A refused pull's warning in report.md now says why, from git's first
error:/fatal: line and the files it lists (an untracked file where the
new commit adds one, a left-over index.lock, a skip-worktree edit),
not git's closing "Aborting". git's words stay out of the issue.

The README no longer says untracked files are always safe: an ignored
file at a path the new commit adds is replaced, as plain git pull does
(pinned by a test).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scuttletoby

Copy link
Copy Markdown
Owner Author

lens: code · reviewer: Claude Opus 5.5 (code lens, round 1) · read at: 2ca778b

blocker: none
major: none
minor: the README sentence "git refuses a pull that would overwrite one (the warning names the file)" could add "in the local report" so nobody looks for the file name in the issue; the sentence after it says so already, so this is wording only.

What I checked

  • The pull path is the same as in gardener: pull the project root before the checks (pull: true) #1267. The only code changes are how _git builds the GitFailed text (_git_said instead of runner._last_line) and the fixed fix words. The pull flags, the -c autostash overrides, the dirty check, the timeout and kill, and GIT_TERMINAL_PROMPT=0 are untouched.
  • git's words stay out of the issue. render_issue builds its rows from id, text, where and fix only. detail (now git's error: line plus file names) goes only to render_local (report.md) and the local log (say). The new tests check that the issue body has no file name, no "overwritten" and no root path.
  • Parsing across git versions and locales. _git already runs git with LC_ALL=C, so the error:/fatal: prefixes and English wording do not depend on the user's locale. git has long printed the listed paths with a leading tab and closed the list with a line that has no tab ("Please move or remove them…"), so the tab rule ends the list correctly. Older git printed a single line instead ("error: Untracked working tree file 'x' would be overwritten by merge."), which still matches as an error: line with no list. remote: error: … does not start with error:, so a remote's text is never picked over git's own reason. When there is no error:/fatal: line, it falls back to the last line as before. The 300-character cap and the 5-name cap keep it to one bounded line.
  • One warning until fixed (index.lock). Nothing is kept between runs. Each run (next day, or --force) runs status and pull from scratch, gets the same refusal, and _not_pulled gives exactly one finding. The test covers a --force rerun with the lock still there (one warning, HEAD unchanged) and the run after the lock is removed (pulls, no warning). The lock is never removed automatically.
  • Tests. The untracked-clash, lock and skip-worktree tests assert the new wording, so they fail on _last_line (the new red-check mutation pins this). The ignored-file test pins the README's claim. The _git_said unit test covers the name cap and the fallback.

State question

  • Runs again: the result depends only on the root as it is now. The same cause gives the same single warning, and once the cause is fixed the next run pulls.
  • Stops half-way: a pull killed during checkout leaves at most index.lock (named on every run until a person removes it), and half-written files show as dirty, so nothing is pulled over them. This PR changes only the message text, not this behaviour.
  • Old or empty state: a config without pull is unchanged (off). Empty stderr from git gives "git exited with N", as before. A missing root keeps its own message.

🤖 Generated with Claude Code

@scuttletoby scuttletoby added the fork:merge-ready Merge conveyor: lenses done, merge when green (PRs) label Nov 29, 2026
@scuttletoby
scuttletoby merged commit bf447ac into main Nov 29, 2026
27 checks passed
@scuttletoby
scuttletoby deleted the gardener-pull-minors branch November 29, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork:merge-ready Merge conveyor: lenses done, merge when green (PRs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant