Am 12.11.2010 16:52, schrieb Jonathan Nieder: > Jens Lehmann wrote: >> Am 11.11.2010 20:00, schrieb Jonathan Nieder: > >>> Yes, that makes some sense to me. Except wouldn't it be a single >>> configuration item? "These submodules should be checked out in all >>> but unusual situations, so check them out automatically and keep them >>> updated." >> >> Hmm, but we have at least three modes of how to update them: >> >> 1) Never fetch the submodule (to get new commits the user has to run >> "git fetch --recurse-submodules" by hand) >> >> 2) Fetch the submodule each time you fetch the superproject (Which is >> really handy when you do development in the submodule too but can >> be really inconvenient when you don't) >> >> 3) Update submodules only when new recorded commits are fetched in >> the superproject (This mode is not added with the current patch >> series but will be in one of the next) >> >> So you would need a config option for that anyway, no? And that is why >> I'd rather like to have a separate fetch option to control that behavior >> instead of an implicit "if-it's-to-be-checked-out-fetch-it-too" approach. > > I still think I am missing something. Ok, I'll try harder to explain my view ;-) > Traditionally, git has been a _content_ tracker. The configuration that > gets transmitted (.gitignore, .gitattributes, .gitmodules) would only > represent basic information needed for that content to remain usable and > sensible. Ack. > In the case of .gitmodules, it seems that two concepts are being > conflated: > > A. Configuration based on the user's preferences. Absolutely, a person > deserves to be able to easily choose between (1), (2), and (3) as > described above. > > B. Metadata about the content that should be shared. For example, "this > submodule would be checked out in all but unusual circumstances" is a > useful thing to be able to declare. No, I think these concepts aren't conflated at all: - Category A is handled by .git/config - Category B is handled by the .gitmodules file Category A should not be handled by a file in the work tree while category B stuff belongs there to be able to share it. That is why git searches all new options in both files with the values from .git/config overriding those from .gitmodules: to provide useful defaults and let the user choose otherwise if he wants to. > Probably I am missing something big, but fetchsubmodules as currently > defined seem like something in category A and not in category B. > Partially because if we ever implement option (3), that is what almost > _every_ casual consumer will want. So why should they be stuck with these > configuration files specifying (1) and (2) when they check out old > revisions? With submodules there never is a one-size-fits-all solution :-) (And we are currently working on option (3), so it will exist rather sooner than later) There are people putting lots of large files in submodules for better performance and they almost always never want to fetch (or even stat) them, so (1) is for them and it's cool that their upstream can configure that, avoiding to have every developer to repeat their "obvious" choice after each clone again (and that might only be needed for some submodules, so a repo-wide config doesn't necessarily help them). And when you are on a superproject branch actively developing inside a submodule, you may want to increase fetch-activity to fetch all new commits in the submodule even if they aren't referenced in the superproject (yet), as that might be just what your fellow developers are about to do. And the person setting up that branch could do that once for all users so they don't have to repeat it in every clone. And when switching away from that branch all those developers cannot forget to reconfigure to fetch-on-demand, so not having that in .git/config is a plus here too. And right, "almost _every_ casual consumer" should start with (3), and that is why it will be the default. So most people will get along without having ever to configure fetch behavior in .gitmodules because git does The Right Thing for them. But in my opinion we should allow that for those other users ... > All that said, I do not think it is unreasonable in some situations for a > project to want to share configuration of type (A) between members of a > project; for example, lots of projects share hooks and that's great. I > just don't think git should set it up automatically --- better to require > an explicit user action like "sh useprojectconfiguration.sh" (an action > more explicit than "please initialize and checkout all relevant > submodules") for such cases. You have no other choice for hooks because of security concerns. But I can't see any downsides in leaving upstream *the choice* to configure default submodule behavior. Lots of people - including me - want that for clone and checkout. And to be consistent the same configuration abilities should be available for fetch too, and if only to follow the principle of least surprise. Thanks Jens -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html