[Libreoffice-commits] core.git: .git-hooks/pre-commit solenv/clang-format sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 15 08:07:51 UTC 2017


 .git-hooks/pre-commit                       |    2 +-
 solenv/clang-format/ClangFormat.pm          |   25 ++++++++++++++-----------
 sw/source/filter/ww8/rtfattributeoutput.cxx |    1 -
 3 files changed, 15 insertions(+), 13 deletions(-)

New commits:
commit 653b513181824f1aae76e6cad0a6a00b4456f6e1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Dec 14 22:23:55 2017 +0100

    clang-format: restore lost warning on touching formatted file without check
    
    Consistently only assign something to $clang_format if it's a good
    version, and also consistently return undef if we found no good version.
    
    Change-Id: Iadbbb56a5c15dfaeec5c80e3cc8fcc78b787c04b
    Reviewed-on: https://gerrit.libreoffice.org/46489
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit
index e25532bb0662..e859919fa566 100755
--- a/.git-hooks/pre-commit
+++ b/.git-hooks/pre-commit
@@ -133,7 +133,7 @@ sub check_style($)
         chomp $filename;
         if ($filename =~ /\.($src)$/ and !exists($blacklist_names->{$filename}))
         {
-            if (! -x $clang_format)
+            if (!defined($clang_format))
             {
                 my $version = ClangFormat::get_wanted_version();
                 my $opt_lo = ClangFormat::get_own_directory();
diff --git a/solenv/clang-format/ClangFormat.pm b/solenv/clang-format/ClangFormat.pm
index 024fe7c1f87f..5aba53fd285c 100644
--- a/solenv/clang-format/ClangFormat.pm
+++ b/solenv/clang-format/ClangFormat.pm
@@ -65,24 +65,27 @@ sub find()
 {
     my $version = get_wanted_version();
     my $opt_lo = get_own_directory();
-    my $clang_format = $ENV{CLANG_FORMAT};
-    if (!(defined($clang_format) && is_matching_clang_format_version($clang_format, $version)))
+    my $clang_format;
+    if (!(defined($ENV{CLANG_FORMAT}) && is_matching_clang_format_version($ENV{CLANG_FORMAT}, $version)))
     {
-        $clang_format = "$opt_lo/clang-format";
-        if (!is_matching_clang_format_version($clang_format, $version))
+        my @dirs = split /:/, $ENV{PATH};
+        unshift(@dirs, $opt_lo);
+
+        foreach my $dir (@dirs)
         {
-            foreach my $dir (split /:/, $ENV{PATH})
+            if (is_matching_clang_format_version("$dir/clang-format", $version))
             {
-                if (is_matching_clang_format_version("$dir/clang-format", $version))
-                {
-                    $clang_format = "$dir/clang-format";
-                    last;
-                }
+                $clang_format = "$dir/clang-format";
+                last;
             }
         }
     }
+    else
+    {
+        $clang_format = $ENV{CLANG_FORMAT};
+    }
 
-    if ($^O eq "cygwin")
+    if ($^O eq "cygwin" && defined($clang_format))
     {
         $clang_format = `cygpath -m '$clang_format'`;
         chomp $clang_format;
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 791ec265b0bd..473bcddf8abf 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -54,7 +54,6 @@
 #include <editeng/paravertalignitem.hxx>
 #include <editeng/blinkitem.hxx>
 #include <editeng/charhiddenitem.hxx>
-#include <svx/fmglob.hxx>
 #include <svx/svdouno.hxx>
 #include <filter/msfilter/rtfutil.hxx>
 #include <sfx2/sfxbasemodel.hxx>


More information about the Libreoffice-commits mailing list