浏览代码

[git-cl] Only ignore deleted files for formatting purposes

Multiple people have complained that we should format files when changing class names. That seems better than not formatting moved/copied files (you can always format a file separately before moving it to workaround the issue of moving unformatted files and presubmit complaining).

This CL essentially reverts https://crrev.com/c/4904205, meaning we will again run clang-format on files that were copied/moved.

https://crrev.com/c/5199134 is probably the proper fix by only looking at lines that were actually changed, but does not yet work with non-C++ formatters.

Checked locally that previously we wouldn't format a moved file, and with this change we now do.

Bug: 737568
Change-Id: Ie12c802316d5e293f2946c532e1600c342caaf59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5840596
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Arthur Eubanks 11 月之前
父节点
当前提交
5eca5541e8
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      git_cl.py

+ 2 - 2
git_cl.py

@@ -6886,8 +6886,8 @@ def CMDformat(parser, args):
         DieWithError('Could not find base commit for this branch. '
                      'Are you in detached state?')
 
-    # Filter out copied/renamed/deleted files
-    diff_output = RunGitDiffCmd(['--name-only', '--diff-filter=crd'],
+    # Filter out deleted files
+    diff_output = RunGitDiffCmd(['--name-only', '--diff-filter=d'],
                                 upstream_commit, files)
     diff_files = diff_output.splitlines()