From 5eca5541e82e2daf130d08d02b0cc66c7357bddc Mon Sep 17 00:00:00 2001 From: Arthur Eubanks Date: Thu, 5 Sep 2024 22:55:26 +0000 Subject: [PATCH] [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 Reviewed-by: Scott Lee --- git_cl.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git_cl.py b/git_cl.py index 394d40db6..d09dcd0b5 100755 --- a/git_cl.py +++ b/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()