Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gitmodules file contains relative paths and not absolute paths #1283

Open
gl-yziquel opened this issue Jun 1, 2024 · 1 comment
Open

.gitmodules file contains relative paths and not absolute paths #1283

gl-yziquel opened this issue Jun 1, 2024 · 1 comment

Comments

@gl-yziquel
Copy link

gl-yziquel commented Jun 1, 2024

Hi.

I've been trying to integrate swipl into my build system. Here is the problem I encountered:

I have a main repository, on which I tinker with swipl-devel code. Then, I have a tool that clones that clone into another repository to perform builds. This allows me to decouple where I store and play with the code with builds on multiple SHAs.

Basically, when you "clone the clone", the remote repository of the clone of the clone is mapped to the clone and not to the github repository. As such, the relative paths for submodules are interpreted as relative to my filesystem and not as relative to the github setup. And it thus fails to clone the submodules.

The way I fix this is via a relatively arcane piece of trickery:

for submodule in $(grep -E "^\[submodule" .gitmodules | sed 's/^\[submodule "//;s/"\]//'); do git config submodule.$submodule.url "$(git config --file /path/to/my/local/git/clone/of/swipl-devel/.git/config --get submodule.$submodule.url)"; done

This is awkward.

A better fix would be to make paths in your repository absolute for submodules in your .gitmodules file.

It would be cleaner anyway: as of now, it couples your repository with the implicit data of the hosting setup (in a non-explicit manner), which is counter to the original intent of git as a distributed system.

@gl-yziquel
Copy link
Author

For any potential reader: discussion occurred on the #1284 pull request.

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

No branches or pull requests

1 participant