2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # Reformat files which are not blacklisted. This is interesting if the
9 # clang-format version or config changes.
10 # -n allows just listing the formatted files.
14 use lib
"solenv/clang-format";
17 my $clang_format = ClangFormat
::find
();
18 my $src = ClangFormat
::get_extension_regex
();
19 my $blacklist_names = ClangFormat
::get_blacklist
();
23 # Get a list of files.
24 open (FILES
, "git ls-files |") || die "Cannot run git ls-files.";
25 while (my $filename = <FILES
>)
28 if ($filename =~ /\.($src)$/ and !exists($blacklist_names->{$filename}))
30 push @filenames, $filename;
34 if ($#ARGV ge 0 && $ARGV[0] eq "-n")
39 foreach my $filename (@filenames)
41 my $command = $clang_format . " -i " . $filename;
42 print($filename . "\n");
49 # vim: set shiftwidth=4 softtabstop=4 expandtab: