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

Fail with diagnostic if submodules don't exist #53

Open
travisdowns opened this issue Aug 2, 2018 · 8 comments
Open

Fail with diagnostic if submodules don't exist #53

travisdowns opened this issue Aug 2, 2018 · 8 comments

Comments

@travisdowns
Copy link
Owner

Many users will probably just git clone followed by make and the submodules will be missing in that case, but the failure mode is a bit obscure: you'll get some weird error as you try to make a submodule that doesn't exist.

We should just check if (some) submodule exists and if not print a diagnostic recommending git submodule update --init.

@nemequ
Copy link
Collaborator

nemequ commented Aug 3, 2018

Or just something like (untested, typing on phone):

submodule/file: .git
    git submodule update --init --recursive

I guess it may be a bit too magical for some people, but I think it makes sense...

@travisdowns
Copy link
Owner Author

@nemequ - duh, not sure why I didn't think of that? I guess I have "source control" and build as separate concerns in my head, but this totally makes sense.

Once question, I'm not following the .git in the prerequisite list. What's that for?

@nemequ
Copy link
Collaborator

nemequ commented Aug 5, 2018 via email

@travisdowns
Copy link
Owner Author

@nemequ I see, so in the case a user downloaded a tarball, they would get some error like "no rule to make .git" or something? Maybe it would be better to just include a recipe line before the git submodule update to fail with an error message if .git doesn't exist.

Git submodules are not really turning out to be as nice a way of including other projects as I had hoped. In particular, the fact that when you do a git pull or whatever and the submodules have been updated on the remote (which I do frequently), it won't update the submodules by default is ... insane IMO.

@nemequ
Copy link
Collaborator

nemequ commented Aug 16, 2018

@nemequ I see, so in the case a user downloaded a tarball, they would get some error like "no rule to make .git" or something?

Right.

Git submodules are not really turning out to be as nice a way of including other projects as I had hoped. In particular, the fact that when you do a git pull or whatever and the submodules have been updated on the remote (which I do frequently), it won't update the submodules by default is ... insane IMO.

That's actually something I like about submodules; if the submodule's API is unstable you can still use them. That said, I wouldn't mind if there were a way to automatically track a branch for submodules you trust won't break their interface.

Also, it may not just be API breaks you have to worry about. I've had API/ABI stable modules break because of files being added/removed… you may need to use your build system instead of theirs. Even if you do use theirs, usually build systems aren't included in the API guarantees.

@travisdowns
Copy link
Owner Author

travisdowns commented Aug 16, 2018

That's actually something I like about submodules...

I probably didn't do a good job of explaining what I meant. You are talking about the feature where you point to a particular commit of a submodule and until you explicitly update that in the parent project, it will stay pointing there. That is great and necessary and I wouldn't want it any other way.

What I'm talking about is that say you and I both have uarch-bench cloned locally and we are both up to date. I make a change that requires an update of submodule A from commit abc to def, and I push that change. Now a new user who clones the project after that has no problem, they'll get version def of A when they do their clone --recursive or whatever. You, however, when you do your next git pull will not get your submodule ref updated to def, you'll still have abc. Whether that breaks or just silently corrupts something or whatever totally depends on the details - but it sucks!

It means that a simple git pull is no longer enough to really stay in sync with the remote, when it comes to subprojects. Basically I think git should behave by default the way it does when you set git config --global submodule.recurse true.

@nemequ
Copy link
Collaborator

nemequ commented Aug 16, 2018

Oh, yeah you're right that's definitely annoying.

FWIW git-radar makes that sort of thing a bit easier to spot.

@travisdowns
Copy link
Owner Author

I think I am just going to get rid of all the submodules and move a git-subtree based approach instead. I have used it on other projects and it seems better in almost every respect.

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

2 participants