diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 6dd4c3c29..03608d185 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -1970,14 +1970,14 @@ def CheckForCommitObjects(input_api, output_api): ] # Get DEPS file. - deps_file = input_api.os_path.join(input_api.PresubmitLocalPath(), 'DEPS') - if not input_api.os_path.isfile(deps_file): - # No DEPS file, carry on! + try: + deps_content = input_api.subprocess.check_output( + ['git', 'show', 'HEAD:DEPS'], cwd=input_api.PresubmitLocalPath()) + deps = _ParseDeps(deps_content) + except Exception: + # No DEPS file, so skip this check. return [] - with open(deps_file) as f: - deps_content = f.read() - deps = _ParseDeps(deps_content) # set default if 'deps' not in deps: deps['deps'] = {}