Add optional parameters to the diff option "--ignore-submodules"
In some use cases it is not desirable that the diff family considers submodules that only contain untracked content as dirty. This may happen e.g. when the submodule is not under the developers control and not all build generated files have been added to .gitignore by the upstream developers. Using the "untracked" parameter for the "--ignore-submodules" option disables checking for untracked content and lets git diff report them as changed only when they have new commits or modified content. Sometimes it is not wanted to have submodules show up as changed when they just contain changes to their work tree. An example for that are scripts which just want to check for submodule commits while ignoring any changes to the work tree. Also users having large submodules known not to change might want to use this option, as the - sometimes substantial - time it takes to scan the submodule work tree(s) is saved. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
cf6aef803d
commit
dd44d419d3
11
diff.c
11
diff.c
@ -2867,7 +2867,16 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
|
||||
DIFF_OPT_CLR(options, ALLOW_TEXTCONV);
|
||||
else if (!strcmp(arg, "--ignore-submodules"))
|
||||
DIFF_OPT_SET(options, IGNORE_SUBMODULES);
|
||||
else if (!strcmp(arg, "--submodule"))
|
||||
else if (!prefixcmp(arg, "--ignore-submodules=")) {
|
||||
if (!strcmp(arg + 20, "all"))
|
||||
DIFF_OPT_SET(options, IGNORE_SUBMODULES);
|
||||
else if (!strcmp(arg + 20, "untracked"))
|
||||
DIFF_OPT_SET(options, IGNORE_UNTRACKED_IN_SUBMODULES);
|
||||
else if (!strcmp(arg + 20, "dirty"))
|
||||
DIFF_OPT_SET(options, IGNORE_DIRTY_SUBMODULES);
|
||||
else
|
||||
die("bad --ignore-submodules argument: %s", arg + 20);
|
||||
} else if (!strcmp(arg, "--submodule"))
|
||||
DIFF_OPT_SET(options, SUBMODULE_LOG);
|
||||
else if (!prefixcmp(arg, "--submodule=")) {
|
||||
if (!strcmp(arg + 12, "log"))
|
||||
|
Reference in New Issue
Block a user