Skip to content

Conversation

@vslashg
Copy link
Member

@vslashg vslashg commented Sep 5, 2023

Fix a bug where a submodule attribute of branch=. was being treated as branch=HEAD.

branch=. is a special value that means a submodule should use the same branch name as the parent branch (see https://git-scm.com/docs/git-submodule#:~:text=same%20name%20as%20the%20current%20branch). Setting it to 'HEAD' is only correct if the main project's HEAD branch is being imported. In particular, this breaks the import of older versions of projects that use branch=. (such at boostorg/boost starting at version 1.70).

It would be possible to plumb information of the main repo's branch name through to listSubmodules() to get the intended network savings here. However, that's a more complex change. Treating branch=. the same as the case where no branch is specified fixes the problem.

Tested:
An import of github.com/boostorg/boost.git for at version 1.72 fails to load the submodules correctly, but works after applying this patch.

Fix a bug where a submodule attribute of `branch=.` was being treated as `branch=HEAD`.

`branch=.` is a special value that means a submodule should use the same branch name as the parent branch (see https://git-scm.com/docs/git-submodule#:~:text=same%20name%20as%20the%20current%20branch).  Setting it to 'HEAD' is only correct if the main project's `HEAD` branch is being imported.  In particular, this breaks the import of older versions of projects that use `branch=.` (such at boostorg/boost starting at version 1.70).

It would be possible to plumb information of the main repo's branch name through to listSubmodules() to get the intended network savings here.  However, that's a more complex change.  Treating `branch=.` the same as the case where no branch is specified fixes the problem.

Tested:
  An import of github.com/boostorg/boost.git for at version 1.72 fails to load the submodules correctly, but works after applying this patch.
@vslashg
Copy link
Member Author

vslashg commented Oct 3, 2023

This was fixed in 4ff3604; thanks!

@vslashg vslashg closed this Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant