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
This commit is contained in:
Gi Vald 2020-08-25 22:37:14 +02:00 committed by serge-sans-paille
parent a0aed80b22
commit 294e1900f2
1 changed files with 2 additions and 1 deletions

View File

@ -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.