Bläddra i källkod

Skip CheckForCommitObjects if not git change

The check relies on `git ls-tree` which is unavailable for non-git
workspaces.

Bug: 333744051
Change-Id: Ib9151a283c3bf543390f2cf06e0ce213051fb509
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5503095
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Gavin Mak 1 år sedan
förälder
incheckning
e75b940aea
1 ändrade filer med 6 tillägg och 0 borttagningar
  1. 6 0
      presubmit_canned_checks.py

+ 6 - 0
presubmit_canned_checks.py

@@ -1957,6 +1957,12 @@ def CheckForCommitObjects(input_api, output_api):
     Returns:
         A presubmit error if a commit object is not expected.
     """
+    if input_api.change.scm != 'git':
+        return [
+            output_api.PresubmitNotifyResult(
+                'Non-git workspace detected, skipping CheckForCommitObjects.')
+        ]
+
     # Get DEPS file.
     deps_file = input_api.os_path.join(input_api.PresubmitLocalPath(), 'DEPS')
     if not input_api.os_path.isfile(deps_file):