Repository navigation
session: a land with a filter program works on Apple Git 2.39 (git-lfs on macOS) - #2035
Merged
Merged
Conversation
AbirAbbas
added a commit
that referenced
this pull request
Oct 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
added a commit
that referenced
this pull request
Oct 29, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
force-pushed
the
fix/land-apple-git-attributes
branch
from
October 29, 2026 23:19
1a060c3 to
c129ad2
Compare
Collaborator
Author
|
Closing unmerged: the Mac push stopped early to save usage. What this fixes and what is left is tracked in #2051. The branch |
AbirAbbas
added a commit
that referenced
this pull request
Nov 2, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
force-pushed
the
fix/land-apple-git-attributes
branch
from
November 2, 2026 13:35
c129ad2 to
de751f5
Compare
With any filter.<driver>.clean|smudge|process configured (git lfs install writes one), every land refused on macOS's own Git 2.39.5: the land asked git var GIT_ATTR_GLOBAL/GIT_ATTR_SYSTEM (Git 2.42) and check-attr --source (Git 2.40), and Apple Git rejects both. The land now learns, once per git executable, whether those queries are unsupported (the exact unsupported answer from a Git that predates them) and then falls back: - each tree's attributes come from a private temporary index outside the repository (read-tree, then check-attr --cached), with split index and hooks off, removed before the plan returns; - the global attribute file is found the way Git finds it (core.attributesFile, else XDG_CONFIG_HOME or HOME), and Apple Git's two system files are bound, honouring GIT_ATTR_NOSYSTEM. A capable Git keeps the native queries and the same plan digest. A non-Apple Git that cannot name its system file still refuses. With no filter program the land still asks Git nothing about attributes (#1995). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…xact unsupported replies Review round 1 of the Apple Git fallback: - /usr/bin/git on macOS is an xcrun shim whose own file does not change when xcode-select picks another Git, so the capability cache now keys on the exact `git version` line as well as the executable's identity. - An unsupported reply counts only when it is the whole reply a Git that predates the query prints (git var's usage line; check-attr's unknown --source option for this source and its usage block), so a warning or a truncated answer refuses and is never cached. - The scratch index refuses when TMPDIR points into the checkout. - The new tests skip on Windows before building fixtures, and the native versus fallback comparison runs whenever the host Git has the query. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…f the checkout by identity Review round 2: - check-attr's unsupported reply must now equal the exact reply a Git that predates --source prints (the unknown-option line for this source and the whole usage block, measured on Apple Git 2.39.5). A bare usage line or an indented warning no longer passes and gets cached. - The scratch directory's ancestors are compared with the checkout root by file identity, so a TMPDIR that names the checkout in another case on a case-insensitive volume refuses before any temporary index is written. - The native half of the native-versus-fallback test fails if it fell back. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The task engine's complexity law holds every function in task*.go to 15 decisions. #1995 left landAttributeFiles and landFilterAttributes over it, and the Apple Git fallback had pushed three more functions past it. The reading is now split along its own phases (answer validation, nested and audited attribute files, version and cache, scratch, indexed reading, native and legacy locations); every function in the file is at or under the ceiling. No behaviour changes: the same commands, refusals, cache and digest bytes (a plan's revision is identical before and after). Co-Authored-By: Claude Opus 5.5 <[email protected]>
AbirAbbas
force-pushed
the
fix/land-apple-git-attributes
branch
from
November 2, 2026 15:45
de751f5 to
45b4b59
Compare
AbirAbbas
marked this pull request as ready for review
November 2, 2026 16:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
On macOS, landing a task branch from the desktop app refused every land whenever any
filter.<driver>.clean|smudge|processprogram was configured.git lfs installwrites exactly that into~/.gitconfig, so anyone with git-lfs installed could not land at all, even in a repository where no file uses LFS. The refusal read "this land cannot determine which files run a filter program".The cause is Apple Git 2.39.5, which is what the app gets from a Finder-launched PATH (
/usr/bin/git). The land's attribute checks (#1995) use two newer Git interfaces:git var GIT_ATTR_GLOBAL/GIT_ATTR_SYSTEM(Git 2.42). Apple Git answersusage: git var (-l | <variable>), exit 129.git check-attr --source=<tree>(Git 2.40). Apple Git answerserror: unknown option `source=…', exit 129.Measured on the Mac (macOS 15.6, Apple Git-154): 4 land tests fail there for this reason alone (
TestAnUnusedFilterDoesNotRefuseALand,TestAUsedFilterRefusesALandWithItsPaths,TestFilterFactsChangingAfterAPlanRefuseTheLand,TestConfigurationALandWillNotMergeUnder).Change
#1995's rule is unchanged: a land refuses only when its paths carry a filter whose driver has a program. With no program configured, the land still asks Git nothing about attributes and starts no new process.
With a program configured, the land now works out per Git executable whether the newer queries are unsupported, and falls back when they are. It caches the answer, keyed by the executable's path and file identity and its exact
git versionline./usr/bin/gitis an xcrun shim whose own file does not change whenxcode-selectpicks another Git, which is why the version line is part of the key.When a query counts as unsupported. Git's reply must be the whole unsupported reply (git var's usage line; check-attr's unknown-option line for this exact
--source, followed by its usage block), with exit 129 and no output, and the version must predate the query. Anything else still refuses: a warning, a truncated reply, an unexpected exit, a timeout. Transient failures are never cached. Vendor backports keep the native query.Tree attributes (fallback). Each tree is read into a fresh index inside a private temporary directory outside the repository (
GIT_INDEX_FILEafter the land'sGIT_*scrub,read-tree, thencheck-attr --cached). Split index and hooks are off, and the directory is removed before the plan returns. The answer goes through the same record validation and hashing as before. ATMPDIRinside the checkout refuses.Attribute files (fallback). The global file is found the way Git finds it:
git config --null --path --get core.attributesFile, else$XDG_CONFIG_HOME/git/attributes, else$HOME/.config/git/attributes, read from the environment the git child actually gets. Apple Git's two system files are bound, honouringGIT_ATTR_NOSYSTEM:%(prefix)/share/git-core/gitattributes, expanded by Git itself;/etc/gitattributes.This is the layout from Apple's own source (apple-oss-distributions/Git,
attr.cin Git-146 through Git-155, withETC_GITATTRIBUTES=/etc/gitattributesin its Makefile). A non-Apple Git older than 2.42 cannot name its compiled system file, so it still refuses, as before.Capable Git (Linux CI, ≥ 2.42). It keeps the native queries in the same order, and the plan's attribute digest has the same bytes.
Docs. The manual's land section is updated, and a change entry is added.
The attribute reading is also split into one job per function. The task engine's complexity law (
TestNoRoadInTheTaskEngineHasMoreEndingsThanItsLedgerRow) holdstask*.gofunctions to 15 decisions, and #1995 had leftlandAttributeFiles(22) andlandFilterAttributes(18) over it. Every function intask_branch_land_filter.gois now at or under the ceiling, so this PR takes two complaints off that test instead of adding any. The split changes no behaviour: the same repository planned by the engine before and after the split gets a byte-identical plan revision.Not changed: merge-driver, sparse and merge-option refusals; the 8 MiB bounds; plan/land revalidation. Apple Git 2.50's native
git var GIT_ATTR_SYSTEMnames only/etc/gitattributesand not Apple's second system file. That only narrows the raw-file binding (the answers still include it), and this PR leaves it as it is.Tests
New, in
internal/session/task_branch_land_filter_test.go:TestALandFallsBackWhenAttributeQueriesAreUnavailablegit lfs installconfig that no path uses lands.TestALandReadsEachTreesAttributesWithoutTheCheckout--source, the fallback digest must equal the native digest.TestALandResolvesLegacyAttributeFilescore.attributesFilegiven as absolute, relative,~/, with whitespace, and empty; then XDG, and empty XDG.changed. An unbound file is proved unbound.GIT_ATTR_NOSYSTEMparsing (last value wins).TestALandsTemporaryIndexLeavesTheRepositoryUntouchedcore.splitIndex=trueand apost-index-changehook are in place, and the hook never runs.sharedindex.*orindex.lockappears, and the real index bytes are unchanged.TestALandRefusesScratchInsideTheRepositoryTestALandCachesOnlyAttributeCapabilitiesTestALandRefusesWhenFallbackAttributesAreUnknownread-tree, and an incomplete, malformed or oversized cached answer, all refuse.Changed:
TestUnknownFilterAttributesRefuseALand's "old attribute-file query" case now also reports a modern version, so it stays a refusal on every host.TestALandWithNoFilterProgramNeverAsksAboutAttributesalso catches the new read-tree, config, version and probe calls.Gates (on the Mac, Apple Git 2.39.5, Go 1.26.5)
gofmt;go vet ./internal/sessionon darwin,GOOS=linuxandGOOS=windows: clean.task_branch_land*_test.go(the darwin-buildable ones), plus the two manual-reading tests ininternal/session: pass. The 4 R3 tests failed before this change and pass after it.-raceon the cache, fallback, scratch and temporary-index tests: pass.internal/commentlaw,internal/guardand the two complexity laws) were run on app/v3 and on this branch and compared by content: no new complaint, and two fewer (above).cmd/codeafland tests (TestABranchLandsOnceOnTheConfirmedPlanand the 3 others): pass.internal/manual/...: pass.go test -count=1 -p 6 ./..., compared by test name with the Mac baseline for app/v3 12dadd6: pending (queued behind the machine-wide heavy-job lock, which waits for the Mac performance baseline).task_branch_land_filter.gocomplexity complaints are gone. The touchedinternal/sessionrun fails only on app/v3's known failures.Manual verification (real engine, desktop wire)
On an isolated codeaf home and an isolated user HOME, the real
codeaf appwas driven over the desktop's JSON-lines protocol (agents.create, thenbranches.land.plan, thenbranches.land). The repository had a recorded task branch, the git was Apple Git 2.39.5, and git-lfs 3.8.0'sgit lfs installhad written the real[filter "lfs"]block into that HOME's.gitconfig:big.binunder*.bin filter=lfs(a real LFS pointer)filter, paths["big.bin"]; nothing ran, HEAD unchangedNo
codeaf-land-attributes-*directory was left behind. Not verified: the desktop window's own Land button, because this Mac has no screen access for the test session; the button drives these same two wire methods.Review
There were three adversarial Codex review rounds.
xcode-selectswitches.TMPDIRpointed there.TMPDIRnaming the checkout in another case on APFS slipped past the name-based containment. Containment now compares directory identities.🤖 Generated with Claude Code