Make git cl format work with relative paths arguments.
BUG=none
Change-Id: I6864a8ac16393410280f8cdd38719b02a81f6ce1
Reviewed-on: https://chromium-review.googlesource.com/424147
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index e089921..e4909ec 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -5179,6 +5179,10 @@
help='Print diff to stdout rather than modifying files.')
opts, args = parser.parse_args(args)
+ # Normalize any remaining args against the current path, so paths relative to
+ # the current directory are still resolved as expected.
+ args = [os.path.join(os.getcwd(), arg) for arg in 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 = settings.GetRelativeRoot()