Subject: [1.8.0] Handle submodule config options consistently in diff plumbing

From: Jens Lehmann <[email-masked]>
Date: Tue, 01 Feb 2011 22:41:11 +0100

Proposal:

Handle the submodule options "diff.ignoreSubmodules" and
"submodule.<name>.ignore" consistently in diff plumbing.

I see two basic ways to change the behavior of the plumbing diff
commands:

a) Let them use the "diff.ignoreSubmodules" configuration too.

b) Don't let them use the "submodule.<name>.ignore" entries either.
   But if we go that way, we might have to revert the default of
   recursing into populated submodules too, as it might cause
   unexpected behavior when all configuration options introduced
   to control that recursion are just ignored unless explicitly
   told otherwise.

History:

When the submodule recursion for the diff commands was introduced,
all diff commands - including plumbing - learned to recurse into
submodules by default. This was done to mark submodules with
uncommitted changes as dirty so no user could accidentally forget
to commit his changes there before pushing in the superproject.

Some time after that "--ignore-submodules" learned some values to
achieve more control over what conditions mark a submodule dirty.
Then the "submodule.<name>.ignore" option was added to .git/config
and the .gitmodules file to to be able to specify these values for
one or more submodules. In a later commit the "diff.ignoreSubmodules"
option was added, but the plumbing diff commands weren't taught to
use that config option.

Risks:

a) Those scripts which depend on the plumbing commands to ignore
   the setting from "diff.ignoreSubmodules" will break.

b) All scripts written or changed since 1.7.0 which depend on the
   current behavior to recurse into submodules and use the
   "submodule.<name>.ignore" entries will be broken.

Me thinks the risks are much smaller when doing a), as people who
learned to use the recursive behavior since 1.7.0 will see that
changed under their feet when we do b) and I expect much more code
to rely on the recursion than on the "diff.ignoreSubmodules"
setting. And doing a) would fix a real life problem too, see [1].

Migration plan:

a) During the 1.7.x series a new "noconfig" value is added for the
   "--ignore-submodules" command line option for people who don't
   want user configuration to interfere with the recursion, e.g. in
   scripts (turning off the recursion is already implemented, just
   use the "--ignore-submodules" option). And then starting with
   1.8.0 "diff.ignoreSubmodules" will be used by diff plumbing.

b) During the 1.7.x series a new value for "--ignore-submodules"
   called "porcelain" is added which enables recursion and also
   tells diff plumbing use all configuration settings. Then all
   relevant call sites (like git gui, gitk and PS1 from completion
   and others) are changed to use this option. Changing the default
   behavior to ignore "submodule.<name>.ignore" and to not recurse
   anymore will be done in the 1.8.0 release.

Personally I'm in favor of solution a), but lets hear what other
people say.

[1] http://thread.gmane.org/gmane.comp.version-control.git/164166/focus=164172