Skip to content

Commit

Permalink
INTERNAL: Add a clean-whitespace script file
Browse files Browse the repository at this point in the history
  • Loading branch information
ing-eoking authored and jhpark816 committed Jan 22, 2025
1 parent 6edb5f7 commit daca0e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,3 @@ tests/memstat
tests/sasl
tests/storage
unittests/unittests
devtools/*
!devtools/maketags.sh
22 changes: 22 additions & 0 deletions devtools/clean-whitespace.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/perl
use strict;
use FindBin qw($Bin);

chdir "$Bin/.." or die;
my @files = `git ls-files` or die;

foreach my $f (@files) {
chomp($f);
next if $f =~ /\.png$/;
open(my $fh, $f) or die;
my $before = do { local $/; <$fh>; };
close ($fh);
my $after = $before;
$after =~ s/\t/ /g;
$after =~ s/ +$//mg;
$after .= "\n" unless $after =~ /\n$/;
next if $after eq $before;
open(my $fh, ">$f") or die;
print $fh $after;
close($fh);
}

0 comments on commit daca0e1

Please sign in to comment.