hanchenye-llvm-project/clang/tools
Stephen Hines 90ced94b22 clang-format: Add an option to git-clang-format to diff between to commits
Summary:
When building pre-upload hooks using git-clang-format, it is useful to limit the scope to a diff of two commits (instead of from a commit against the working tree) to allow for less false positives in dependent commits.

This change adds the option of specifying two git commits to git-clang-format when using the `--diff` flag, which uses a different strategy to diff (using `git-diff-tree` instead of `git-diff-index`), and runs clang-format against the second commit instead of the working directory.

There is a slight backwards-incompatibility introduced with this change: if a filename matches a branch name or other commit-ish, then `git clang-format <commit> <file>` will no longer work as expected; use `git clang-format <commit> -- <file>` instead.

Patch by Luis Hector Chavez!

Reviewers: djasper, lodato

Subscribers: lodato, cfe-commits, srhines

Projects: #clang-c

Differential Revision: https://reviews.llvm.org/D24319

llvm-svn: 282136
2016-09-22 05:52:55 +00:00
..
arcmt-test [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
c-arcmt-test Remove autoconf support 2016-01-26 21:30:40 +00:00
c-index-test [c-index-test] Make sure to check that clang_Cursor_getNumTemplateArguments did not return -1. 2016-07-30 02:20:21 +00:00
clang-check Frontend: Simplify ownership model for clang's output streams. 2016-07-15 00:55:40 +00:00
clang-format clang-format: Add an option to git-clang-format to diff between to commits 2016-09-22 05:52:55 +00:00
clang-format-vs clang-format VS plugin: upgrade the project files to VS2015 2016-09-15 19:44:49 +00:00
clang-fuzzer Add missing header in ClangFuzzer (after r275882 cleanup) 2016-07-18 20:33:09 +00:00
clang-offload-bundler [clang-offload-bundler] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes. 2016-09-07 17:37:28 +00:00
diag-build
diagtool [NFC] Header cleanup 2016-07-18 19:02:11 +00:00
driver [clang-cl] Check that we are in clang cl mode before enabling support for the CL environment variable. 2016-09-06 10:48:27 +00:00
libclang ObjectiveC generics: Add ObjCTypeParamType in the type system. 2016-09-13 17:25:08 +00:00
scan-build scan-build: Add an option to show the description in the list of defect 2016-08-01 08:04:45 +00:00
scan-build-py [analyzer] scan-build-py: Remove relative path hack for SATestsBuild.py 2016-09-14 18:14:11 +00:00
scan-view Remove autoconf support 2016-01-26 21:30:40 +00:00
CMakeLists.txt clang-offload-bundler - offload files bundling/unbundling tool 2016-08-24 15:21:05 +00:00