Repository navigation
Commit 1dfe4e2
fix(submodule): resolve
gitmodules(5) defines `submodule.<name>.branch = .` as "the same name
as the superproject's current branch". With the superproject on `dev`,
`git submodule update --init --remote` checks out the submodule's `dev`
tip. When update() cloned such a submodule it looked for a remote
branch literally named `.` and never found it: from `repo.submodules`
it logged "Failed to checkout tracking branch refs/heads/." and stayed
on the remote's default branch, so `to_latest_revision=True` moved the
submodule to the wrong tip; after `set_parent_commit()` the branch is
re-read without the refs/heads/ prefix and `branch_name` raised
ValueError instead, for a named branch such as `dev` as well as `.`.
Normalize the configured branch to a full ref first, then resolve
`refs/heads/.` to the superproject's active branch before the
remote-branch lookup. A detached superproject keeps the previous
behaviour (the lookup fails and the warning is logged); git refuses in
that case. Already-cloned submodules are not touched: update() follows
their existing tracking branch, as before.
The new `branch-dot` fixture puts the superproject clone on `dev`.
`test_update_to_latest_revision_follows_superproject_branch` covers the
`repo.submodules` path and the re-read path, and
`test_update_to_latest_revision_after_reread_follows_named_branch` the
re-read of `dev`; both fail without this change under the `cli` and
`gix` backends and pass with it. A third test pins the detached case.
Agent-Model: claude-opus-5-5branch = . when update() clones a submodule1 parent 06aa1cd commit 1dfe4e2
3 files changed
Lines changed: 70 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1097 | 1097 | | |
1098 | 1098 | | |
1099 | 1099 | | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
1100 | 1104 | | |
1101 | 1105 | | |
1102 | | - | |
1103 | | - | |
| 1106 | + | |
| 1107 | + | |
1104 | 1108 | | |
1105 | 1109 | | |
1106 | 1110 | | |
1107 | 1111 | | |
1108 | 1112 | | |
1109 | 1113 | | |
1110 | 1114 | | |
1111 | | - | |
| 1115 | + | |
1112 | 1116 | | |
1113 | 1117 | | |
1114 | 1118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1943 | 1943 | | |
1944 | 1944 | | |
1945 | 1945 | | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
1946 | 1994 | | |
1947 | 1995 | | |
1948 | 1996 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
49 | 64 | | |
50 | 65 | | |
51 | 66 | | |
| |||
0 commit comments