[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>
changes/96/5840596/5
Arthur Eubanks 11 months ago committed by LUCI CQ
parent 9bbf9b0541
commit 5eca5541e8

@ -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()

Loading…
Cancel
Save