]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Make find-doc-nits compatible accross git versions
authorNeil Horman <nhorman@openssl.org>
Wed, 3 Dec 2025 19:36:54 +0000 (14:36 -0500)
committerNeil Horman <nhorman@openssl.org>
Fri, 5 Dec 2025 15:09:08 +0000 (10:09 -0500)
We recently found that the addition of a git config command in
util/find-doc-nits is broken in some cases, sepecifically because git
around version 2.46 broke command line compatibility, replacing the
--regexp option with the --get-regexp option.  So to maintain usage of
this specific command to parse the .gitconfig file, we would need to do
some extra version detection to construct the proper command line.

However, find-doc-nits already has a fallback condition, which does some
pure perl parsing of the gitconfig file, which works perfectly well.

Instead of trying to do version matching to construct the right form of
the git config command line, just remove it all, and rely on the perl
parrse to do this work for us, which works currently in all cases.

Fixes #29197

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/29304)

util/find-doc-nits

index f7092bf129010a8cba868ba7cd71d0cc0cfe72ee..fb3288c2d18da328f1e0601390fc4fd2208406de 100755 (executable)
@@ -1297,33 +1297,14 @@ sub check_env_vars {
     my @env_headers;
     my @env_macro;
 
-    # Add submodules to the except_dirs
-    my $git_ok = 0;
-    open my $gs_pipe, '-|', "git config get --all "
-                            . "--file \"$config{sourcedir}/.gitmodules\" "
-                            . "--regexp '.*.path\$'";
-    while (<$gs_pipe>) {
-        $git_ok = 1;
-        s/\R$//; # better chomp
-        print STDERR "DEBUG[check_env_vars]: adding \"$config{sourcedir}/$_\""
-                     . " to except_dirs\n"
-            if $debug;
-        push @except_dirs, "$config{sourcedir}/$_";
-    }
-    close $gs_pipe;
-    # git call has failed, trying to parse .gitmodules manually
-    if (!$git_ok) {
-        print STDERR "DEBUG[check_env_vars]: .gitmodules parsing fallback\n"
-            if $debug;
-        if (open my $gs_file, '<', "$config{sourcedir}/.gitmodules") {
-            while (<$gs_file>) {
-                s/\R$//; # better chomp
-                if ($_ =~ /\s*path\s*=\s*(.*)$/) {
-                    print STDERR "DEBUG[check_env_vars]: adding "
-                                 . "\"$config{sourcedir}/$1\" to except_dirs\n"
-                        if $debug;
-                    push @except_dirs, "$config{sourcedir}/$1";
-                }
+    if (open my $gs_file, '<', "$config{sourcedir}/.gitmodules") {
+        while (<$gs_file>) {
+            s/\R$//; # better chomp
+            if ($_ =~ /\s*path\s*=\s*(.*)$/) {
+                print STDERR "DEBUG[check_env_vars]: adding "
+                             . "\"$config{sourcedir}/$1\" to except_dirs\n"
+                    if $debug;
+                push @except_dirs, "$config{sourcedir}/$1";
             }
         }
     }
@@ -1338,7 +1319,7 @@ sub check_env_vars {
     @except_env_files = map { realpath($_) } @except_env_files;
 
     # look for source files
-    $git_ok = 0;
+    my $git_ok = 0;
     open my $glf_pipe, '-|', "git ls-files -- \"$config{sourcedir}\"";
     while (<$glf_pipe>) {
         $git_ok = 1;