ortogonal added inline comments.

================
Comment at: clang/tools/clang-format/git-clang-format:140
     if not opts.diff:
       die('--diff is required when two commits are given')
   else:
----------------
lodato wrote:
> Does there need to be an equivalent check that --staged requires --diff? 
> Could you test to make sure that works as expected?
Sorry, new to this system. I wrote a reply to this, but it seemed to get lost 
when uploading. Let me try again :)

The check that you can't use `--staged` with two commits is enough. For example 
it you do:
```
git clang-format --diff --staged 53f64aa089c5fd335b1337cab7eaa99d072a25fc 
273e318e1ff0fae58ec7ed248ee3c9c73da8c00e
error: --staged is not allowed when two commits are given
```

But you are allowed to run just `git clang-format --staged`. It you do:
```
$ git add foo.cc
$ git clang-format --staged
changed files:
    foo.cc
```
This will run clang-format on the staged changes on foo.cc.

It this what you meant or did I misunderstand you.

Thanks for your review!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90996/new/

https://reviews.llvm.org/D90996

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to