Revert "presubmit: update CheckPatchFormatted to pass --input_diff_file"

This reverts commit 4689d66abf.

Reason for revert: causing issues in b/386840832

Original change's description:
> presubmit: update CheckPatchFormatted to pass --input_diff_file
>
> Once devs update depot_tools, this will take effect in both
> terminal and CiderG
>
> TESTED: http://go/scrcast/NjM1MzE5NDc4NjQ4ODMyMHxmMzc3NGVlZi03Yg
> Bug: 386840832
> Change-Id: Ibb8f74bffd662eb330f61b9e82bcd75c09bbc232
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6937365
> Commit-Queue: Scott Lee <ddoman@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>

Bug: 386840832
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I0bb79952aab4e0fa29607c79ea14f13f2a2a7bb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6939736
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
This commit is contained in:
Scott Lee
2025-09-11 16:29:34 -07:00
committed by LUCI CQ
parent 106981b2c9
commit 3accee0833

View File

@@ -1838,10 +1838,6 @@ def CheckPatchFormatted(input_api,
result_factory=None):
result_factory = result_factory or output_api.PresubmitPromptWarning
import git_cl
affected_files = input_api.AffectedFiles(include_deletes=False)
with input_api.CreateTemporaryFile() as diff_file:
for f in affected_files:
diff_file.write(f.GenerateScmDiff().encode('utf-8'))
display_args = []
if not check_clang_format:
@@ -1861,13 +1857,8 @@ def CheckPatchFormatted(input_api,
cmd = [
'-C',
input_api.change.RepositoryRoot(),
'cl',
'format',
'--dry-run',
'--presubmit',
'--input_diff_file',
diff_file.name,
input_api.change.RepositoryRoot(), 'cl', 'format', '--dry-run',
'--presubmit'
] + display_args
# Make sure the passed --upstream branch is applied to a dry run.
@@ -1894,13 +1885,11 @@ def CheckPatchFormatted(input_api,
else:
short_path = input_api.basename(input_api.change.RepositoryRoot())
display_args.append(presubmit_subdir)
msg = (
'The %s directory requires source formatting. '
'Please run: git cl format %s. Or, if you are in CiderG, '
'please use the "Format Modified Lines in All Files '
'(git cl format)" functionality in the command palette.' % (
short_path, ' '.join(display_args)))
return [result_factory(msg)]
return [
result_factory('The %s directory requires source formatting. '
'Please run: git cl format %s' %
(short_path, ' '.join(display_args)))
]
return []