From d431e7606be223a05c118b4e4f6ba07428a02f2d Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Tue, 14 May 2024 22:20:21 +0000 Subject: [PATCH] requires files for git cl lint if called in cog Reason: In cog, there's currently no way to get the file diff. Bug: 339231299 Change-Id: Ibe1cf771fbc84a1710ce7f72d13250877d4d21a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5539168 Commit-Queue: Yiwei Zhang Reviewed-by: Scott Lee --- git_cl.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/git_cl.py b/git_cl.py index b895ab06d..c04defad8 100755 --- a/git_cl.py +++ b/git_cl.py @@ -4638,6 +4638,9 @@ def FindFilesForLint(options, args): else: print('%s is not a file' % fn) return None, None + elif gclient_utils.IsEnvCog(): + print('Error: missing files to lint') + return None, None else: # If file names are omitted, use the git APIs to find the files to lint. include_regex = re.compile(settings.GetLintRegex()) @@ -4666,8 +4669,10 @@ def CMDlint(parser, args): """Runs cpplint on the current changelist or given files. positional arguments: - files Files to lint. If omitted, it will run cpplint against - all the affected files in the current git checkout. + files Files to lint. If omitted in the current git checkout, it + will run cpplint against all the affected files. If it is + not executed in git checkouts, files to lint must be + provided. """ parser.add_option( '--filter',