[PATCH] [clang-format] use --no-ext-diff when generating diffs

Mike Frysinger via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 17 10:23:29 PST 2022


From: Mike Frysinger <vapier at chromium.org>

If the user's ~/.gitconfig sets diff.external to a GUI program,
git-clang-format fails pretty badly.  Make sure to pass --no-ext-diff
so the output is deterministic as we expect.
---
 clang/tools/clang-format/git-clang-format | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format
index 7968c4387574..174d8bb94f94 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -526,8 +526,8 @@ def print_diff(old_tree, new_tree):
   # We also only print modified files since `new_tree` only contains the files
   # that were modified, so unmodified files would show as deleted without the
   # filter.
-  subprocess.check_call(['git', 'diff', '--diff-filter=M', old_tree, new_tree,
-                         '--'])
+  subprocess.check_call(['git', 'diff', '--no-ext-diff', '--diff-filter=M',
+                         old_tree, new_tree, '--'])
 
 def print_diffstat(old_tree, new_tree):
   """Print the diffstat between the two trees to stdout."""
-- 
2.34.1



More information about the llvm-commits mailing list