Repository navigation
Conversation
With `submodule.<name>.branch = .`, `Submodule.branch_name` returned `.`, `branch_path` returned `refs/heads/.` and `branch` built a head named `.`, none of which Git accepts as a branch, although `update(to_latest_revision=True)` already resolves `.` to the superproject's current branch. The accessors now resolve `.` through `_superproject_branch()`, the `git symbolic-ref --quiet HEAD` lookup `_branch_for_update()` already used, on every call. They follow later superproject branch switches and re-reads after `set_parent_commit()`, and raise `ValueError` when the superproject HEAD is detached, as their docstrings now say. The configured value stays in `_branch_path`; `__repr__` shows it so that `repr()` cannot raise. `RootModule.update()` compares the configured values between revisions, so `dev` to `.` is a change even while both select `dev`. Tracking setup uses `_branch_for_update()`, which keeps the `.git/config` override first. With a detached superproject it logs a warning and leaves the submodule on the recorded commit, as an ordinary update does. On a URL change the commit check now looks in the submodule's branch on the new remote; it used `self.branch_name`, which is the root module's default branch. Four new tests cover branch switches with and without a re-read, detached HEAD for all three accessors, a change from `dev` to `.` in `RootModule.update()` (also on a detached superproject), and a URL change while the submodule tracks `dev` on a new remote without `master`, which raised `IndexError: No item found with id origin/master` before. They fail without this change and pass with it under the `cli` and `gix` backends. `doc/source/changes.rst` notes the new `ValueError` under API changes, and the GIX-44 row in `doc/gix-backend.md` now names `_superproject_branch()` and its callers. Agent-Model: claude-opus-5-5
On Windows the submodule remote URL comes back with forward slashes, so comparing it to `str(moved)` failed on every Windows job. Use `Path(...).samefile(...)` as the other URL checks in this file do. Validated with `test/test_submodule.py` under the `cli` and `gix` backends on Linux; the Windows result comes from CI. Agent-Model: claude-opus-5-5
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 muthaf*ckin' free
to join this conversation on GitHub.
Already have an muthaf*ckin' account?
Sign in to comment
Add this suggestion to a motherf*ckin' batch that can be applied as a goddamn single commit, believe that.This muthaf*ckin' suggestion is invalid because no changes were made to the muthaf*ckin' code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a f*ckin' subset of changes.Only one suggestion per line can be applied in a damn batch. Hell yeah.Add this suggestion to a motherf*ckin' batch that can be applied as a goddamn single commit, believe that.Applying suggestions on deleted lines is not supported, for real.You must change the existing code in this motherf*ckin' line in order to create a valid suggestion.Outdated suggestions cannot be applied. Mm-hmm.This suggestion has been applied or marked goddamn resolved.Suggestions cannot be applied from muthaf*ckin' pending reviews.Suggestions cannot be applied on motherf*ckin' multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied f*ckin' right now. Please check back later.
I am a muthaf*ckin' Claude (Opus 5.5) agent working through the contributor's account. That's some bullsh*t.
Follow-up suggested in #2363 (#2363 (comment)).
With
branch = .,Submodule.branch_namereturned.andbranch_pathreturnedrefs/heads/., which Git rejects as branch names, althoughupdate(to_latest_revision=True)already resolves.to the superproject's current branch. The motherf*ckin' accessors (andbranch) now resolve it the same way on each call, so they follow later branch switches and re-reads afterset_parent_commit(). With a muthaf*ckin' detached superproject HEAD they raiseValueError, as their docstrings document, so code that reads them on a muthaf*ckin' detached superproject withbranch = .now gets an exception where it used to get.. The configured value stays in_branch_pathand__repr__shows it, sorepr()does not raise.RootModule.update()compares the configured values between revisions, sodevto.counts as a change even while both selectdev. Tracking setup uses_branch_for_update(), which keeps the.git/configoverride first. Get this sh*t: A detached superproject logs a goddamn warning and leaves the submodule on the goddamn recorded commit, as an ordinary update does. When the URL changes, the bad-ass commit check now looks in the goddamn submodule's branch on the new remote; it usedself.branch_name, the root module's default branch. Mm-hmm.Four new tests cover:
devto.inRootModule.update(), on a muthaf*ckin' detached superproject toodevon a new remote withoutmaster, which raisedIndexError: No item found with id origin/masterbeforeThey fail without the change and pass with it under both
GIT_PYTHON_BACKEND=cliandgix. The full suite passes under both backends (GixPython 0.4.0). Ruff check and format pass, and mypy reports no issues. Tested only on Linux with Git 2.56.0.doc/source/changes.rstgets an goddamn API-changes bullet for the newValueErrorand the goddamn URL-change fix, and the GIX-44 row indoc/gix-backend.mdnames the accessors that now reach thegit symbolic-reffallback.