Fix auto-style target reporting
This commit is contained in:
parent
4805f20f44
commit
ba341883b9
@ -179,18 +179,18 @@ unless dry_run = pushref.empty?
|
|||||||
end
|
end
|
||||||
git = Git.new(oldrev, newrev, branch)
|
git = Git.new(oldrev, newrev, branch)
|
||||||
|
|
||||||
paths = git.updated_paths
|
updated_files = git.updated_paths
|
||||||
paths.select! {|l|
|
files = updated_files.select {|l|
|
||||||
/^\d/ !~ l and /\.bat\z/ !~ l and
|
/^\d/ !~ l and /\.bat\z/ !~ l and
|
||||||
(/\A(?:config|[Mm]akefile|GNUmakefile|README)/ =~ File.basename(l) or
|
(/\A(?:config|[Mm]akefile|GNUmakefile|README)/ =~ File.basename(l) or
|
||||||
/\A\z|\.(?:[chsy]|\d+|e?rb|tmpl|bas[eh]|z?sh|in|ma?k|def|src|trans|rdoc|ja|en|el|sed|awk|p[ly]|scm|mspec|html|)\z/ =~ File.extname(l))
|
/\A\z|\.(?:[chsy]|\d+|e?rb|tmpl|bas[eh]|z?sh|in|ma?k|def|src|trans|rdoc|ja|en|el|sed|awk|p[ly]|scm|mspec|html|)\z/ =~ File.extname(l))
|
||||||
}
|
}
|
||||||
files = paths.select {|n| File.file?(n) }
|
files.select! {|n| File.file?(n) }
|
||||||
files.reject! do |f|
|
files.reject! do |f|
|
||||||
IGNORED_FILES.any? { |re| f.match(re) }
|
IGNORED_FILES.any? { |re| f.match(re) }
|
||||||
end
|
end
|
||||||
if files.empty?
|
if files.empty?
|
||||||
puts "No files are a auto-style target:\n#{paths.join("\n")}"
|
puts "No files are an auto-style target:\n#{updated_files.join("\n")}"
|
||||||
exit
|
exit
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ edited_files = files.select do |f|
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if edited_files.empty?
|
if edited_files.empty?
|
||||||
puts "All edited lines are formatted well:\n#{paths.join("\n")}"
|
puts "All edited lines are formatted well:\n#{files.join("\n")}"
|
||||||
else
|
else
|
||||||
msg = [('remove trailing spaces' if trailing),
|
msg = [('remove trailing spaces' if trailing),
|
||||||
('append newline at EOF' if eofnewline),
|
('append newline at EOF' if eofnewline),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user