[clang] 294e190 - Fix quiet mode in git-clang-format
via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 26 09:16:50 PDT 2020
Author: Gi Vald
Date: 2020-08-26T18:15:52+02:00
New Revision: 294e1900f281f35aff0362232225e85c2e551e55
URL: https://github.com/llvm/llvm-project/commit/294e1900f281f35aff0362232225e85c2e551e55
DIFF: https://github.com/llvm/llvm-project/commit/294e1900f281f35aff0362232225e85c2e551e55.diff
LOG: Fix quiet mode in git-clang-format
Quiet mode is very useful for scripting, when only the diff format output is
required, or no output if not formatting is needed.
In case of no modified files, git-clang-format will output to screen even though
the quiet mode enabled.
This patch changes this behavior, so if quiet flag passes in - no output will be
available, even if no modified files exists.
Differential Revision: https://reviews.llvm.org/D85485
Added:
Modified:
clang/tools/clang-format/git-clang-format
Removed:
################################################################################
diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format
index f3cd585e7f4a..e4dc4cbc1dc9 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -148,7 +148,8 @@ def main():
for filename in changed_lines:
print(' %s' % filename)
if not changed_lines:
- print('no modified files to format')
+ if opts.verbose >= 0:
+ print('no modified files to format')
return
# The computed
diff outputs absolute paths, so we must cd before accessing
# those files.
More information about the cfe-commits
mailing list