Kaydet (Commit) abe4eaf5 authored tarafından Miklos Vajna's avatar Miklos Vajna

clang-format: allow just listing formatted files

Without running clang-format on them. Also format one file at a time, so
we don't run into command line length limits as the number of formatted
files grows.

Change-Id: Ie559d566db784e04965678f056dcb81cefe95378
Reviewed-on: https://gerrit.libreoffice.org/48085Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst 4a0f506f
......@@ -7,6 +7,7 @@
# Reformat files which are not blacklisted. This is interesting if the
# clang-format version or config changes.
# -n allows just listing the formatted files.
use strict;
use warnings;
......@@ -17,6 +18,7 @@ my $clang_format = ClangFormat::find();
my $src = ClangFormat::get_extension_regex();
my $blacklist_names = ClangFormat::get_blacklist();
my @filenames = ();
my $dry_run = 0;
# Get a list of files.
open (FILES, "git ls-files |") || die "Cannot run git ls-files.";
......@@ -29,7 +31,19 @@ while (my $filename = <FILES>)
}
}
print("$clang_format -i " . join(" ", @filenames) . "\n");
system("$clang_format -i " . join(" ", @filenames) . "\n");
if ($#ARGV ge 0 && $ARGV[0] eq "-n")
{
$dry_run = 1;
}
foreach my $filename (@filenames)
{
my $command = $clang_format . " -i " . $filename;
print($filename . "\n");
if (!$dry_run)
{
system($command);
}
}
# vim: set shiftwidth=4 softtabstop=4 expandtab:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment