|
196 | 196 | $opt_v , |
197 | 197 | $opt_vcs , |
198 | 198 | $opt_version , |
| 199 | + $opt_include_submodules , |
199 | 200 | $opt_include_content , |
200 | 201 | $opt_exclude_content , |
201 | 202 | $opt_exclude_lang , |
@@ -332,6 +333,7 @@ my $getopt_success = GetOptions( # {{{1 |
332 | 333 | "v|verbose:i" => \$opt_v , |
333 | 334 | "vcs=s" => \$opt_vcs , |
334 | 335 | "files-from=s" => \$opt_vcs , # synonym |
| 336 | + "include-submodules" => \$opt_include_submodules , |
335 | 337 | "version" => \$opt_version , |
336 | 338 | "write_lang_def|write-lang-def=s" => \$opt_write_lang_def , |
337 | 339 | "write_lang_def_incl_dup|write-lang-def-incl-dup=s" => \$opt_write_lang_def_incl_dup, |
@@ -443,6 +445,7 @@ load_from_config_file($config_file, # {{{2 |
443 | 445 | \$opt_3 , |
444 | 446 | \$opt_v , |
445 | 447 | \$opt_vcs , |
| 448 | + \$opt_include_submodules , |
446 | 449 | \$opt_version , |
447 | 450 | \$opt_write_lang_def , |
448 | 451 | \$opt_write_lang_def_incl_dup, |
@@ -714,6 +717,7 @@ if (defined $opt_vcs) { |
714 | 717 | } |
715 | 718 | if ($opt_vcs eq "git") { |
716 | 719 | $opt_vcs = "git -c \"safe.directory=*\" ls-files"; |
| 720 | + $opt_vcs .= " --recurse-submodules" if $opt_include_submodules; |
717 | 721 | my @submodules = invoke_generator("git -c \"safe.directory=*\" submodule status", \@ARGV); |
718 | 722 | foreach my $SM (@submodules) { |
719 | 723 | $SM =~ s/^\s+//; # may have leading space |
@@ -1931,14 +1935,13 @@ Usage: $script [options] <file(s)/dir(s)/git hash(es)> | <set 1> <set 2> | <repo |
1931 | 1935 | --files-from=<CMD> Synonym for --vcs=<CMD>. |
1932 | 1936 | --vcs=<CMD> Invoke a system call to <CMD> to obtain a list of |
1933 | 1937 | files to work on. If <CMD> is 'git', then will |
1934 | | - invoke 'git ls-files' to get a file list and |
1935 | | - 'git submodule status' to get a list of submodules |
1936 | | - whose contents will be ignored. See also --git |
1937 | | - which accepts git commit hashes and branch names. |
1938 | | - If <VCS> is 'svn' then will invoke 'svn list -R'. |
1939 | | - The primary benefit is that cloc will then skip |
1940 | | - files explicitly excluded by the versioning tool |
1941 | | - in question, ie, those in .gitignore or have the |
| 1938 | + invoke 'git ls-files' to get a file list. Submodules |
| 1939 | + are ignored unless --include-submodules is also |
| 1940 | + given. See also --git which accepts git commit hashes |
| 1941 | + and branch names. If <VCS> is 'svn' then will invoke |
| 1942 | + 'svn list -R'. The primary benefit is that cloc will |
| 1943 | + then skip files explicitly excluded by the versioning |
| 1944 | + tool in question, ie, those in .gitignore or have the |
1942 | 1945 | svn:ignore property. |
1943 | 1946 | Alternatively <CMD> may be any system command |
1944 | 1947 | that generates a list of files. |
@@ -2251,6 +2254,8 @@ Usage: $script [options] <file(s)/dir(s)/git hash(es)> | <set 1> <set 2> | <repo |
2251 | 2254 | Count only the given comma separated, case- |
2252 | 2255 | insensitive languages L1, L2, L3, et cetera. Use |
2253 | 2256 | --show-lang to see the list of recognized languages. |
| 2257 | + --include-submodules When using --vcs=git, include files in git |
| 2258 | + submodules. |
2254 | 2259 | --match-d=<regex> Only count files in directories matching the Perl |
2255 | 2260 | regex. For example |
2256 | 2261 | --match-d='/(src|include)/' |
@@ -15279,6 +15284,7 @@ sub load_from_config_file { # {{{1 |
15279 | 15284 | $rs_3 , |
15280 | 15285 | $rs_v , |
15281 | 15286 | $rs_vcs , |
| 15287 | + $rs_include_submodules , |
15282 | 15288 | $rs_version , |
15283 | 15289 | $rs_write_lang_def , |
15284 | 15290 | $rs_write_lang_def_incl_dup, |
@@ -15391,6 +15397,7 @@ sub load_from_config_file { # {{{1 |
15391 | 15397 | } elsif (!defined ${$rs_unicode} and /^unicode/) { ${$rs_unicode} = 1; |
15392 | 15398 | } elsif (!defined ${$rs_3} and /^3/) { ${$rs_3} = 1; |
15393 | 15399 | } elsif (!defined ${$rs_vcs} and /^vcs(=|\s+)(\S+)/) { ${$rs_vcs} = $2; |
| 15400 | + } elsif (!defined ${$rs_include_submodules} and /^include-submodules/) { ${$rs_include_submodules} = 1; |
15394 | 15401 | } elsif (!defined ${$rs_version} and /^version/) { ${$rs_version} = 1; |
15395 | 15402 | } elsif (!defined ${$rs_write_lang_def} and /^(?:write_lang_def|write-lang-def)(=|\s+)(.*?)$/) { ${$rs_write_lang_def} = $2; |
15396 | 15403 | } elsif (!defined ${$rs_write_lang_def_incl_dup} and /^(?:write_lang_def_incl_dup|write-lang-def-incl-dup)(=|\s+)(.*?)$/) { ${$rs_write_lang_def_incl_dup} = $2; |
|
0 commit comments