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>
changes/47/424147/4
Daniel Cheng 9 years ago committed by Commit Bot
parent d3cee645d7
commit c55eecf76b

@ -5179,6 +5179,10 @@ def CMDformat(parser, args):
help='Print diff to stdout rather than modifying files.') help='Print diff to stdout rather than modifying files.')
opts, args = parser.parse_args(args) 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 # git diff generates paths against the root of the repository. Change
# to that directory so clang-format can find files even within subdirs. # to that directory so clang-format can find files even within subdirs.
rel_base_path = settings.GetRelativeRoot() rel_base_path = settings.GetRelativeRoot()

Loading…
Cancel
Save