Repository navigation
adopt-project.py: _unlisted_ref_directory (#1252) lists refs under reftable too, so check refuses source-unreadable a reftable source whose .git/refs this user cannot list, where git lists every ref and check said plan ok (rv1265 N1 on #1265; follows #1219 and #1257) #1291
Description
(lane openRepoShape-3, 2026-11-09T22:05:03Z)
Found by: rv1265, lane 5's independent review (Opus) of PR #1265 (for #1257) at 59c6ecac, finding N1 (#1265 issuecomment-6724906723, relayed to lane 3 as asked in issuecomment-6724147738). It is filed on Brett Heap's word "file follow-ups 5, 10 and 15" (2026-11-09). It is on v1.2.2, the patch after v1.2.1, which adds no command and no flag.
It builds after #1252 lands. #1252 (for #1219) is lane 3's, on v1.2.1, and is not on main at filing (open, head 64a3d7d29). Its code is cited here from that head (git show of refs/pull/1252/head), so its line numbers move when it is squashed. The reach that makes the wrong refusal common comes from #1265 (for #1257; lane 3's, v1.2.1, open at filing, head 1a9782900; rv1265 reviewed 59c6ecac).
Lines for main are at 8cf6477fe, read and not run. Nothing was probed for this body, and reftable was not probed at all: this workstation's git is 2.43, and reftable needs 2.45 or later. The measurement is rv1265's, on git 2.47.1. This body is ASCII.
What is missing
A person can see it: check refuses a source it can read. A clone made on the reftable backend, whose .git/refs directory this user cannot list, is refused source-unreadable naming refs, though git lists all of its refs and exits 0. rv1265 measured it (N1, quoted exactly; "the head" is #1265's 59c6ecac, and b7a00b3 is #1265's base):
N1. A wrong refusal on a reftable source, newly reachable here. On git 2.47.1, a reftable clone with
.git/refsat--x:
- git lists all 4 refs and exits 0;
- b7a00b3's
checksaysplan ok(57 calls);- the head refuses
source-unreadable: the source'srefs...: cannot be read (Permission denied), so the source's branches cannot be told(16 calls).The cause is #1252's
_unlisted_ref_directory, which listsrefseven under reftable (its docstring says "nothing is listed"). Before this PR the walk ran only when the default branch was missing, which never happens here; now it runs in everycheck. The mode is contrived and reftable is opt-in, so this does not block. It could go to a #1252 follow-up: skip the walk whererefs/headsis a file.refs/heads/.hidden(RV1252 N2) gets the same wider reach, and the body already says so.
rv1265's report opens "I measured everything on uid 1000 with real modes, git 2.43.0 and 2.47.1, Python 3.12.3." It does not say which of its probe files holds the reftable one (its folder is /workspace/projects/.lane-worktrees/openRepoShape-5/work/rv1265).
Why (the code, read and not run)
On main (8cf6477fe) none of it exists: _branch_names (adopt-project.py:3268) takes (path, prefix) and has no walk. At #1252's head 64a3d7d29:
_unlisted_ref_directory(adopt-project.py:3354). Its docstring, at:3370, says "Under a reftablerefs/headsis a file, and nothing is listed." The code does not test for that before it lists::3372at = PurePosixPath(target.parts[0])starts atrefs, the first part ofrefs/heads/(BRANCH_REFS,:10561) and ofrefs/remotes/origin/(ORIGIN_BRANCHES,:5235);:3377for name in _listed_names(common.joinpath(*at.parts)) or ():lists it;_listed_names(:3388) isos.scandir, and raises any refusal but "absent";:3379-3381asks whether an entry is a directory (_is_a(..., stat.S_ISDIR)) only afterrefshas been listed, sorefs/headsbeing a file is learned too late;:3384return at, excon anyOSError._refuse_unlisted_refs(:3331) turns it intosource-unreadable, "the source'srefs" and its path, "so the source's branches cannot be told" (BRANCHES_UNTOLD).
- What the tool already knows of reftable.
adopt-project.py:11056-11064(REFTABLE_DIRS,REFTABLE_FILES): "the reftable backend keeps them (git 2.45 and later ... measured with git 2.47.1): arefs/headsthat is a file, andreftable, whose tables hold every ref". That is the clone's own copy check, not the source's, but it is the same fact. - On adopt-project.py: a source whose
refsthis user cannot list is refusedsource-unreadablenaming the directory, neversource-default-branch-not-local"(its branches: none)" (#1219) #1252 alone the walk is rarely reached._branch_names(:3321) asks only where the wanted branch is not among git's names;_symbolic_ref(:3288) only wheregit symbolic-ref -qexits other than 0 and 1;_tracking_branch_problem(:5282) only where the tracking branch is not among_branches_of's. Each is "asked only where git's answer was none", and on a reftable source git lists, so rv1265 says it "never happens here". - At adopt-project.py: a stale split branch in a source refs directory this user cannot list is refused
source-unreadableby name, neverplan okfromcheckor two legs made byexecute(#1257) #1265's head1a9782900it is asked every time._refuse_unlisted_refs_if_seen(:9896) calls_unlisted_ref_directory(common, prefix)from_branches_at(:9984) and_branches_in(:10138), whichcheckandexecuterun for the split branch, "in every source no earlier run left one in" (its docstring)._common_dir_on_disk(:9920) gives.gitfor a.gitdirectory, so for a reftable clone the walk lists.git/refs, as rv1265 saw.
The fix (as rv1265 framed it: "skip the walk where refs/heads is a file"; the writer settles the open choices)
- To settle: what says "reftable". rv1265's test is
refs/headsbeing a file, read on the common git directory the walk is given (not onpath/.git, so a linked worktree is read where its refs are). Another isreftablebeing a directory there (REFTABLE_DIRS,:11063). Say which, and what a source with neither reads as (today's walk, unchanged). - To settle: how much of the walk to skip. rv1265 says "the walk"; under reftable git lists no directory for
refs/heads/(the docstring), and it is not measured here forrefs/remotes/origin/. The writer measures it on git 2.45 or later, withORIGIN_BRANCHESas well asBRANCH_REFS, before choosing between skipping the walk whole and skipping onlyrefs. - A source on the files backend keeps today's answer:
refs,refs/headsandrefs/remotes/originat 000,--xandr--still refused by name (adopt-project.py: a source whose.git/refs/headsthis user cannot read is refusedsource-default-branch-not-localwith(its branches: none), a false list, where the refusal should name the directory git could not list #1219's and adopt-project.py: a stale split branch in a source refs directory this user cannot list is refusedsource-unreadableby name, wherechecksaysplan okbecause_branches_atand_branches_inread the directory as empty #1257's rows). - No new command or flag (v1.2.2 is a patch).
Rows (they must fail before the change)
- A reftable clone (made as the repository's other reftable rows make one; not probed here),
.git/refsat--x(and at 000):checksaysplan ok, as at b7a00b3. It fails on adopt-project.py: a source whoserefsthis user cannot list is refusedsource-unreadablenaming the directory, neversource-default-branch-not-local"(its branches: none)" (#1219) #1252 plus adopt-project.py: a stale split branch in a source refs directory this user cannot list is refusedsource-unreadableby name, neverplan okfromcheckor two legs made byexecute(#1257) #1265 withsource-unreadable, "the source'srefs". It needs git 2.45 or later and is skipped where git is older, as the repository's other reftable rows are, and as the mode rows are as root. - A row that runs on any git: a hand-made common directory where
refs/headsis a file andrefsis at--x, and_unlisted_ref_directory(common, "refs/heads/")is None. By the code it is(refs, PermissionError)today (read, not run). - The same two for
ORIGIN_BRANCHES, where the writer's measurement says they hold. - A files-backend source with
refsat--xis still refused, held by an existing row (name it). - A mutant: the skip taken out. The reftable row must fail on it.
Not here
refs/heads/.hiddenreaches the same wider walk (rv1265 N1, naming RV1252's N2). It is a files-backend question, and rv1265 says adopt-project.py: a stale split branch in a source refs directory this user cannot list is refusedsource-unreadableby name, neverplan okfromcheckor two legs made byexecute(#1257) #1265's body already says so; it is not read here.- rv1265's N2 to N4 (five surviving mutants in adopt-project.py: a stale split branch in a source refs directory this user cannot list is refused
source-unreadableby name, neverplan okfromcheckor two legs made byexecute(#1257) #1265's rows, a docstring that says git refuses a NUL it reads, the first box's "checkandplan") are adopt-project.py: a stale split branch in a source refs directory this user cannot list is refusedsource-unreadableby name, neverplan okfromcheckor two legs made byexecute(#1257) #1265's. execute --local-remote-dirwithrefs/remotes/origin/adoptatr--(rv1265's "Out of scope") is its own.- Whether the walk should run in every
checkis adopt-project.py: a stale split branch in a source refs directory this user cannot list is refusedsource-unreadableby name, neverplan okfromcheckor two legs made byexecute(#1257) #1265's decision, which rv1265 judged READY.
Done when
- A reftable source with
.git/refsunlistable is read as git reads it, andchecksaysplan ok, as before adopt-project.py: a stale split branch in a source refs directory this user cannot list is refusedsource-unreadableby name, neverplan okfromcheckor two legs made byexecute(#1257) #1265. A row, on git 2.45 or later, fails on main plus adopt-project.py: a source whoserefsthis user cannot list is refusedsource-unreadablenaming the directory, neversource-default-branch-not-local"(its branches: none)" (#1219) #1252 plus adopt-project.py: a stale split branch in a source refs directory this user cannot list is refusedsource-unreadableby name, neverplan okfromcheckor two legs made byexecute(#1257) #1265. - A files-backend source keeps every refusal it has, by the same rows.
- The choice of test for "reftable" is written where the next writer will read it.
See #1219, #1252, #1257 and #1265.
Lane: openreposhape-3 (openRepoShape-3)
Activity
brettheap commentedon Nov 9, 2026
CLAIMED — lane openRepoShape-3, session b30e8b49-f249-4668-adb1-1dbfa93c09e1@Eagle, 2026-11-09T22:08:03Z, for #1291
Logged in
lanes/log/openRepoShape-3.mdat153e5b34fd339f6449ad6552b7434f195b7a4f33.The three reads (lane-collision-protocol Rule 1):