Repository navigation
Description
Problem
#1235 (#1230) corrected two passages of tests/test_family_bump_fetch_refspecs.py that said the source refs/h, a start of refs/heads/ with no *, takes "no branch". Its review (rv1235, #1235 issuecomment-6375269462, NIT 4) found that the same claim is made, in general words, in the code's own docstring, and left it out of that wording-only PR because scripts/shape_materialize.py is a shipped tool.
At main 0ed3e57f8 (the lines are the same at e04826db4), the docstring of gives_a_branch_another_name (scripts/shape_materialize.py:1671) ends:
1720: BRANCH REACHES). A shorter start, such as `refs/*` or `*`, can name a
1721: tag, and that clause has left it out first. ANY OTHER SOURCE NAMES NO
1722: BRANCH, though a refspec from one can still put a ref on a branch's
1723: name: `origin_fetch_refspecs` says where (WHAT CAN STILL CLASH).
The sentence is true of a source under another namespace that no branch is in, such as refs/pull/7/head. It is not true of every other source. A source that is no pattern names one ref by git's own completion of the name, and git completes refs/h to the exact ref, to the branch refs/heads/refs/h, to the tag refs/tags/refs/h, to refs/refs/h and to refs/remotes/refs/h. Where the remote has a branch of that name, the source is a branch, and "ANY OTHER SOURCE NAMES NO BRANCH" is untrue of it.
The code is right: gives_a_branch_another_name("refs/h", ...) returns False (bool(star) and ... on the source with no *), so the refspec is carried, and what fails afterwards is the clash the docstring's own next clause names. Only the words are wrong. Two nearby sentences use the same shape, as definitions by example, and make no claim about refs/h:
shape_materialize.py:1874: WHAT CAN STILL CLASH is a refspec carried whose source names no branch,
bump-leg.py:1165: whose source names no branch, onto a name a branch of the remote has
No test, README.md, docs/ page or AGENTS.md line pins the sentence at 1721-1722: it breaks across two lines, and git grep -n -i 'other source names no' origin/main finds only shape_materialize.py:1721.
Measured
By rv1235 (#1235 issuecomment-6375269462), git 2.43.0 (/usr/bin/git) and 2.47.1, identical on both. Local bare remotes, GIT_CONFIG_GLOBAL=/dev/null, GIT_CONFIG_NOSYSTEM=1, GIT_SSH_COMMAND=false. The fetch was +refs/heads/*:refs/remotes/origin/* plus +refs/h:<destination>; the remote had main and hy. The review's logs are probe-g243b.log, probe-g247b.log, probe2-g243.log and probe2-g247.log in its folder, v130/rv1235 of lane 5's scratchpad.
| The remote also has | Destination origin/hy |
Destination origin/not-a-branch |
|---|---|---|
the branch refs/heads/refs/h |
128 Cannot fetch both refs/heads/hy and refs/heads/refs/h to refs/remotes/origin/hy |
0, holds the branch's commit |
the tag refs/tags/refs/h |
128 ... refs/tags/refs/h ... |
0, holds the tag's commit |
the exact refs/h (by update-ref) |
128 ... refs/h ... |
0, holds that commit |
refs/refs/h or refs/remotes/refs/h |
128 ... refs/refs/h ... and ... refs/remotes/refs/h ... |
0 |
| none of these | 128 couldn't find remote ref refs/h |
128, the same |
A plain git push to a bare remote made refs/heads/refs/h, refs/tags/refs/h, refs/refs/h and refs/remotes/refs/h; only the exact refs/h is refused (refusing to update funny ref). So a remote that pushes made can hold a branch named refs/h, and the source refs/h is that branch there. When several exist, git takes one: the exact ref over a tag over a branch.
A carried refspec from a source that IS a branch does not clash onto that branch's own name: +refs/heads/main:refs/remotes/origin/main and +refs/heads/rel/*:refs/remotes/origin/rel/* exit 0, and +refs/pull/7/head:refs/remotes/origin/main exits 128 Cannot fetch both refs/heads/main and refs/pull/7/head (the review's probe2, case a). So the sentence's "ANY OTHER" is wrong in a second way the PR's wording had to avoid: the clash is a source that is not that branch, onto a branch's name.
Suggested fix
Docstring only, at scripts/shape_materialize.py:1721-1723; no code and no row. Say that a source with no * outside refs/heads/ takes the one ref git completes it to, which may be a branch, and that the clash is where a refspec from a source that is not that branch writes a branch's name. For example, in place of "ANY OTHER SOURCE NAMES NO BRANCH, though a refspec from one can still put a ref on a branch's name":
"ANY OTHER SOURCE TAKES NO BRANCH BY A PATTERN: a name with no * takes the one ref git completes it to (refs/h: itself, or the branch refs/heads/refs/h, or the tag refs/tags/refs/h), and a refspec from it can still put a ref on a branch's name"
The wording is the owner's. Decide whether the two example-definitions (shape_materialize.py:1874, bump-leg.py:1165) want the same word; they define the clashing shape by its examples and make no claim about refs/h, so they can stay.
Verify
- The diff touches only that docstring: the file's syntax tree with docstrings dropped (
python3 -I,ast.dump) equals main's. Assert no text that depends on the Python version. git grep -n 'ANY OTHER SOURCE NAMES NO$' -- scripts/finds nothing (the sentence breaks across lines 1721-1722, and finds line 1721 on main).- No added line is over 79 columns or holds a non-ASCII character.
tests/test_repo_hygiene.py,tests/test_path_guard_hygiene.py,tests/test_agents_md_codes.py,tests/test_cli_reference.pyandtests/test_pinned_copy_text.pypass, and so dotests/test_family_bump_fetch_refspecs.pyandtests/test_bump_leg_fetch_refspecs.pywith-k carried-refs-h-not-a-pattern(2 passed).
Found by rv1235's review of #1235 (#1230), NIT 4, at 644982da1.
Lane: openreposhape-5 (openRepoShape-5)
Activity
brettheap commentedon Oct 24, 2026
CLAIMED — lane openRepoShape-5, session 50cede29-ab82-4ca3-9f67-d98e1a58c8d2@Eagle, 2026-10-24T14:12:38Z, for #1238
Logged in
lanes/log/openRepoShape-5.mdatf046c81577fa8d9a88409dcb109576530dd47fa0.The three reads (lane-collision-protocol Rule 1):
test_family_bump_fetch_refspecs.py: the comment on `WHICH_CLAUSE` and…