diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-06-17 23:06:41 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-06-17 23:06:41 +0900 |
commit | c99cb62da81646e54ffb391b5cb1d2a3bc45bc0c (patch) | |
tree | 4c235b11b448826a0e85fce9f14800f16a3d7d9d /tool/auto-style.rb | |
parent | 8faa32327b0327981880f8651f6dd782d14f9ae1 (diff) |
Fix up tool/auto-style.rb
Do not clear the commit-wide flags per file.
Diffstat (limited to 'tool/auto-style.rb')
-rwxr-xr-x | tool/auto-style.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tool/auto-style.rb b/tool/auto-style.rb index 7e66f376ec..0c6ce6848a 100755 --- a/tool/auto-style.rb +++ b/tool/auto-style.rb @@ -233,11 +233,10 @@ edited_files = files.select do |f| if File.fnmatch?("*.[ch]", f, File::FNM_PATHNAME) && !DIFFERENT_STYLE_FILES.any? {|pat| File.fnmatch?(pat, f, File::FNM_PATHNAME)} - orig = src.dup - src.gsub!(/^\w+\([^(\n)]*?\)\K[ \t]*(?=\{$)/, "\n") - src.gsub!(/^([ \t]*)\}\K[ \t]*(?=else\b)/, "\n" '\1') - src.gsub!(/^[ \t]*\}\n\K\n+(?=[ \t]*else\b)/, '') - indent = indent0 = src != orig + indent0 = true if src.gsub!(/^\w+\([^(\n)]*?\)\K[ \t]*(?=\{$)/, "\n") + indent0 = true if src.gsub!(/^([ \t]*)\}\K[ \t]*(?=else\b)/, "\n" '\1') + indent0 = true if src.gsub!(/^[ \t]*\}\n\K\n+(?=[ \t]*else\b)/, '') + indent ||= indent0 end if trailing0 or eofnewline0 or expandtab0 or indent0 |