[clang] [clang-format] Fix a bug in `git-clang-format --binary` (PR #74293)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 4 01:51:38 PST 2023
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/74293
>From a394ac020c1045705fb2898d32754bdf12fac4bd Mon Sep 17 00:00:00 2001
From: Owen Pan <owenpiano at 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, 4 insertions(+), 1 deletion(-)
diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format
index 6e827e17b4ee2..f7b25b7deae2b 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -153,7 +153,10 @@ 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 os.path.dirname(opts.binary):
+ opts.binary = os.path.abspath(opts.binary)
+
changed_lines = compute_diff_and_extract_lines(commits, files, opts.staged)
if opts.verbose >= 1:
ignored_files = set(changed_lines)
More information about the cfe-commits
mailing list