Bug 1552775 git clang-format hook: Ignore deleted files. r=sylvestre
authorAndreas Farre <farre@mozilla.com>
Mon, 20 May 2019 11:43:04 +0000
changeset 474705 06c314174286c2dbca838812e38c2fb8b04bc142
parent 474704 9bcf8d6124584b76919e7c1018427e96d47029d1
child 474706 d4c346b146a1b9f123fa3a704f23ff1196209fae
push id113168
push userrmaries@mozilla.com
push dateTue, 21 May 2019 16:39:23 +0000
treeherdermozilla-inbound@3c0f78074b72 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssylvestre
bugs1552775
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1552775 git clang-format hook: Ignore deleted files. r=sylvestre Differential Revision: https://phabricator.services.mozilla.com/D31758
tools/lint/hooks_clang_format.py
--- a/tools/lint/hooks_clang_format.py
+++ b/tools/lint/hooks_clang_format.py
@@ -75,17 +75,17 @@ def hg(ui, repo, node, **kwargs):
 
 def git():
     hooktype = os.path.basename(__file__)
     if hooktype == "hooks_clang_format.py":
         hooktype = "pre-push"
 
     try:
         changedFiles = check_output(
-            ["git", "diff", "--staged", "--name-only", "HEAD"]
+            ["git", "diff", "--staged", "--diff-filter=d", "--name-only", "HEAD"]
         ).split()
         # TODO we should detect if we are in a "add -p" mode and show a warning
         return run_clang_format(hooktype, changedFiles)
 
     except CalledProcessError:
         print("Command to retrieve local files failed")
         return 1