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

Root .gitmodules shared between multiple yadm configurations #149

MyNameIsCosmo opened this Issue Mar 12, 2019 · 3 comments


None yet
2 participants
Copy link

MyNameIsCosmo commented Mar 12, 2019

When using multiple YADM configs (alias yadm-bin='yadm --yadm-repo ~/bin, etc), and when adding submodules, YADM writes to the same ~/.gitmodules file.

This has not been an issue for me, and I don't think this actually entails an issue in yadm, but I felt it should be brought up for future consideration and testing.

This is actually an issue, where the same .gitmodules file will be added to each yadm configuration using submodules.


This comment has been minimized.

Copy link

MyNameIsCosmo commented Mar 12, 2019

Perhaps yadm can wrap around submodule like so:

yadm-bin update-index --no-assume-unchanged
yadm-bin stash push -m 'yadm submodule' .gitmodules  # reference git home dir
yadm-bin submodule add <blah>
yadm-bin add .gitmodules  # I think this is done automatically
yadm-bin stash pop  # maybe we can track the index from above? does it matter?
yadm-bin update-index --assume-unchanged .gitmodules

This comment has been minimized.

Copy link

TheLocehiliosan commented Mar 15, 2019

This is sort-of a fundamental part of how submodules are implemented in Git. Git wants to get that information from the .gitmodules in the work tree. To the best of my knowledge, the only way to have Git look for that elsewhere is with a one of the most recent releases of Git. That version has the ability to read the .gitmodules information from the blob in the repo, and only falls back on that if the work tree version is missing. I think the use case for that involves a sparse-checkout configuration.

The crux of the issue is that you have multiple repos sharing the same work tree. Tracking data with multiple repos contradicts one of yadm's core design principles (using a single repo). If you really want to track the data in multiple repos, you might want to try out vcsh. Although, if I remember correctly, vcsh actually has problems with submodules for the same reason.

I would be very hesitant to introduce any special handling of the submodule operation, as an effort to support multiple repositories. However, hooks could be a great way to implement your idea in a shareable way. This is exactly the kind of niche use case that hooks were implemented for.


This comment has been minimized.

Copy link

MyNameIsCosmo commented Mar 15, 2019

Thanks for the information!

I'm using YADM to split up my .dotfiles and .dotfiles.private.
The yadm-bin example was just an off-the-top example.

This behavior makes sense. It has not been a problem for me (yet) since I don't actually use git submodule (I either use plugin managers, or something like vcs-tool).

Closing this for now, as this isn't really an issue but should be known for future adventurers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.