Bug 1541409 - git clang-format hook: add files one by one to avoid an error r=sheehan
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 08 Apr 2019 16:18:38 +0000
changeset 468377 400fd14b1c831f7fbe70acf045901b0ebcc48829
parent 468376 45f4b01dee1ab5d451eda76070b98030272dd3dd
child 468378 c568adf3602bce1d618a00f3e97b7361b8d540db
push id35835
push useraciure@mozilla.com
push dateMon, 08 Apr 2019 19:00:29 +0000
treeherdermozilla-central@40456af7da1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssheehan
bugs1541409
milestone68.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 1541409 - git clang-format hook: add files one by one to avoid an error r=sheehan Differential Revision: https://phabricator.services.mozilla.com/D26444
tools/lint/hooks_clang_format.py
--- a/tools/lint/hooks_clang_format.py
+++ b/tools/lint/hooks_clang_format.py
@@ -31,18 +31,22 @@ def run_clang_format(hooktype, changedFi
     # On windows we need this to call the command in a shell, see Bug 1511594
     if os.name == "nt":
         clang_format_cmd = ["sh", "mach"] + arguments
     else:
         clang_format_cmd = [os.path.join(topsrcdir, "mach")] + arguments
     if "commit" in hooktype:
         # don't prevent commits, just display the clang-format results
         subprocess.call(clang_format_cmd)
+
         # Add the modified files back to the repo (expect a string)
-        vcs.add_remove_files(" ".join(changedFiles))
+        # one by one (fails otherwise, see bug #1541409)
+        for f in changedFiles:
+            vcs.add_remove_files(f)
+
         return False
     print("warning: '{}' is not a valid clang-format hooktype".format(hooktype))
     return False
 
 
 def hg(ui, repo, node, **kwargs):
     print(
         "warning: this hook has been deprecated. Please use the hg extension instead.\n"