From c55eecf76bdb96b904aaaee93fe4c67bbbb102d9 Mon Sep 17 00:00:00 2001 From: Daniel Cheng Date: Fri, 30 Dec 2016 03:11:02 -0800 Subject: [PATCH] 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 Commit-Queue: Daniel Cheng --- git_cl.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git_cl.py b/git_cl.py index e089921fb..e4909ece3 100755 --- a/git_cl.py +++ b/git_cl.py @@ -5179,6 +5179,10 @@ def CMDformat(parser, args): 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()