From c99cb62da81646e54ffb391b5cb1d2a3bc45bc0c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 17 Jun 2025 23:06:41 +0900 Subject: [PATCH] Fix up tool/auto-style.rb Do not clear the commit-wide flags per file. --- tool/auto-style.rb | 9 ++++----- 1 file 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