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

Should git submodules be handled like "regular" contents of the source directory? #1106

Closed
zb140 opened this issue Mar 28, 2021 · 1 comment
Labels
support Support request

Comments

@zb140
Copy link
Collaborator

zb140 commented Mar 28, 2021

What exactly are you trying to do?

I've got a few external git repositories added as submodules in my dotfiles (for example, https://github.com/tmux-plugins/tpm). This generally works acceptably well, except when it doesn't 😉 The issue I'm running up against right now is that there are many shell scripts in that repo that are all committed as executable. The submodule gets added to my source directory just fine, but when chezmoi apply processes them, the executable bit of course gets lost (since chezmoi uses the executable_ attr instead). Not only that, but at least one of the scripts is called run_tests, which gets interpreted as a script to be run at apply time.

What have you tried so far?

In this case, I can fix the run_tests issue by just adding that file to .chezmoiignore, but the executable bits issue is much more complicated. I could use my own run_after_ script to fix up the exec bit, but then future calls to chezmoi apply complain (correctly) that the files have been modified since the last time they were written by apply.

Additional context

Am I going about this completely the wrong way? Would it be better to manage these modules completely outside of chezmoi? I guess I could probably put together a run_after_ script that does the cloning, but git submodule add feels easier. On the other hand, I suppose (without having investigated at all) that chezmoi might not even know that a given file is in a submodule, so maybe it couldn't treat it differently even if that seemed like a good idea. What do you think?

@zb140 zb140 added the support Support request label Mar 28, 2021
@zb140
Copy link
Collaborator Author

zb140 commented Mar 28, 2021

I woke up this morning and had a bit of an epiphany: I am going about this the wrong way. Logically these external packages aren't really "submodules" at all. I replaced them with a simple run_once_after_ script that does a git clone and things are working much better now. Also, I had another look through the already-filed issues and it looks like this might tie into #662 as well.

@zb140 zb140 closed this as completed Mar 28, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
support Support request
Projects
None yet
Development

No branches or pull requests

1 participant