https://github.com/owenca created https://github.com/llvm/llvm-project/pull/74293
This is a rework of #74176. >From fddf15404c0f5de2d9b264413b94d45a4a73edde Mon Sep 17 00:00:00 2001 From: Owen Pan <owenpi...@gmail.com> Date: Mon, 4 Dec 2023 01:03:18 -0800 Subject: [PATCH] [clang-format] Fix a bug in `git-clang-format --binary` This is a rework of #74176. --- clang/tools/clang-format/git-clang-format | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format index 6e827e17b4ee2..1a4d7670bcf79 100755 --- a/clang/tools/clang-format/git-clang-format +++ b/clang/tools/clang-format/git-clang-format @@ -105,7 +105,7 @@ def main(): usage=usage, formatter_class=argparse.RawDescriptionHelpFormatter, description=desc) p.add_argument('--binary', - default=config.get('clangformat.binary', 'clang-format'), + type=os.path.abspath, help='path to clang-format'), p.add_argument('--commit', default=config.get('clangformat.commit', 'HEAD'), @@ -153,7 +153,8 @@ def main(): else: if len(commits) > 2: die('at most two commits allowed; %d given' % len(commits)) - opts.binary=os.path.abspath(opts.binary) + if opts.binary is None: + opts.binary = config.get('clangformat.binary', 'clang-format') changed_lines = compute_diff_and_extract_lines(commits, files, opts.staged) if opts.verbose >= 1: ignored_files = set(changed_lines) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits