[clang] b5fbc60 - [clang-format] State where clang-format-diff.py should be run from

David Spickett via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 30 02:01:00 PST 2020


Author: David Spickett
Date: 2020-11-30T10:00:49Z
New Revision: b5fbc60e4de45f2b56331281a706b78ff52bd286

URL: https://github.com/llvm/llvm-project/commit/b5fbc60e4de45f2b56331281a706b78ff52bd286
DIFF: https://github.com/llvm/llvm-project/commit/b5fbc60e4de45f2b56331281a706b78ff52bd286.diff

LOG: [clang-format] State where clang-format-diff.py should be run from

At least with git, file paths in a diff will be relative
to the repo root. So if you are in "llvm-project/lldb"
and the diff shows "clang/foo" modified you get:
No such file or directory

>From clang-format-diff.py, since clang-format was
asked to read:
llvm-project/lldb/clang/foo

Add a note to the docs to explain this.

(there is `git diff --relative` but that excludes
changes outside of the current dir)

Reviewed By: sylvestre.ledru

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

Added: 
    

Modified: 
    clang/docs/ClangFormat.rst

Removed: 
    


################################################################################
diff  --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst
index d396667ce10c..b746ed3453df 100644
--- a/clang/docs/ClangFormat.rst
+++ b/clang/docs/ClangFormat.rst
@@ -248,6 +248,9 @@ In an SVN client, you can do:
 The option `-U0` will create a 
diff  without context lines (the script would format
 those as well).
 
+These commands use the file paths shown in the 
diff  output
+so they will only work from the root of the repository.
+
 Current State of Clang Format for LLVM
 ======================================
 


        


More information about the cfe-commits mailing list