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

Unified Diff: git_cl.py

Issue 108353005: Let git cl format be runnable outside of the root (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 7 years 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 bad3e657979cdb7ed6abe3f85c7412fbc36a5ffd..c401f0e762f20e421906e16a2fa4f2ac67a02783 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2248,6 +2248,12 @@ def CMDformat(parser, args):
if args:
parser.error('Unrecognized args: %s' % ' '.join(args))
+ # git diff generates paths against the root of the repository. Change
+ # to that directory so clang-format can find files even within subdirs.
+ rel_base_path = RunGit(['rev-parse', '--show-cdup']).strip()
+ if rel_base_path:
+ os.chdir(rel_base_path)
+
# Generate diff for the current branch's changes.
diff_cmd = ['diff', '--no-ext-diff', '--no-prefix']
if opts.full:
« 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