Re: [PATCH] D15465: [git-clang-format]: New option to perform formatting against staged changes only
lodato added inline comments. Comment at: git-clang-format:124 @@ -121,3 +123,3 @@ del opts.quiet commit, files = interpret_args(opts.args, dash_dash, opts.commit) lodato wrote: > This will work without `--diff` (otherwise it will try to apply changes in > the index to the working directory, which doesn't make sense), so could you > please add a check that `--staged` requires `--diff`? Oops, will //not// work. Repository: rL LLVM http://reviews.llvm.org/D15465 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15465: [git-clang-format]: New option to perform formatting against staged changes only
lodato added a subscriber: lodato. lodato requested changes to this revision. lodato added a reviewer: lodato. lodato added a comment. This revision now requires changes to proceed. This does not work properly because it calls `clang-format` on the files in the working directory, even if `--staged` is given. To fix, you need to somehow pass in the version of the files in the index into `clang-format`. To do that, I think you'd want to pass in the blob via stdin and add `-assume-filename=...` to the command line. Example: $ mkdir tmp $ cd tmp $ git init $ cat > foo.cc < foo.cc