Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: git_cl.py

Issue 1734863002: Fix git cl format when it finds no clang-formattable files. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 3023213ddd903a9d696f48eea7c79f04964f079e..48d44f53cd09ec12a9e1672b693a5fd822aa9840 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -3584,35 +3584,35 @@ def CMDformat(parser, args):
# formatted. This is used to block during the presubmit.
return_value = 0
- if opts.full:
- if clang_diff_files:
+ if clang_diff_files:
+ if opts.full:
cmd = [clang_format_tool]
if not opts.dry_run and not opts.diff:
cmd.append('-i')
stdout = RunCommand(cmd + clang_diff_files, cwd=top_dir)
if opts.diff:
sys.stdout.write(stdout)
- else:
- env = os.environ.copy()
- env['PATH'] = str(os.path.dirname(clang_format_tool))
- try:
- script = clang_format.FindClangFormatScriptInChromiumTree(
- 'clang-format-diff.py')
- except clang_format.NotFoundError, e:
- DieWithError(e)
+ else:
+ env = os.environ.copy()
+ env['PATH'] = str(os.path.dirname(clang_format_tool))
+ try:
+ script = clang_format.FindClangFormatScriptInChromiumTree(
+ 'clang-format-diff.py')
+ except clang_format.NotFoundError, e:
+ DieWithError(e)
- cmd = [sys.executable, script, '-p0']
- if not opts.dry_run and not opts.diff:
- cmd.append('-i')
+ cmd = [sys.executable, script, '-p0']
+ if not opts.dry_run and not opts.diff:
+ cmd.append('-i')
- diff_cmd = BuildGitDiffCmd('-U0', upstream_commit, clang_diff_files)
- diff_output = RunGit(diff_cmd)
+ diff_cmd = BuildGitDiffCmd('-U0', upstream_commit, clang_diff_files)
+ diff_output = RunGit(diff_cmd)
- stdout = RunCommand(cmd, stdin=diff_output, cwd=top_dir, env=env)
- if opts.diff:
- sys.stdout.write(stdout)
- if opts.dry_run and len(stdout) > 0:
- return_value = 2
+ stdout = RunCommand(cmd, stdin=diff_output, cwd=top_dir, env=env)
+ if opts.diff:
+ sys.stdout.write(stdout)
+ if opts.dry_run and len(stdout) > 0:
+ return_value = 2
# Similar code to above, but using yapf on .py files rather than clang-format
# on C/C++ files
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698