[clang] [clang-format] Add "three dot" diff option to git-clang-format (PR #74230)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 4 05:44:47 PST 2023


================
@@ -153,8 +157,13 @@ def main():
   else:
     if len(commits) > 2:
       die('at most two commits allowed; %d given' % len(commits))
+  if len(commits) < 2 and opts.diff_from_common_commit:
+    die('--diff_from_common_commit is only allowed when two commits are given')
----------------
owenca wrote:

Let's fix the unreachable line 159 above while we are at it:
```suggestion
  if len(commits) > 2:
    die('at most two commits allowed; %d given' % len(commits))
  if len(commits) == 2:
    if opts.staged:
      die('--staged is not allowed when two commits are given')
    if not opts.diff:
      die('--diff is required when two commits are given')
  elif opts.diff_from_common_commit:
    die('--diff_from_common_commit is only allowed when two commits are given')
```

https://github.com/llvm/llvm-project/pull/74230


More information about the cfe-commits mailing list