From 1c38c7c1c9048a0b75ab34d0c8d9e62ba4f93d4f Mon Sep 17 00:00:00 2001 From: Rob Mohr Date: Thu, 2 Jan 2020 10:33:46 -0800 Subject: [PATCH] Skip deleted files in presubmit. Change-Id: I9998b3b606773ca1fdc5330c311820f977506b13 --- pw_presubmit/py/pw_presubmit/tools.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pw_presubmit/py/pw_presubmit/tools.py b/pw_presubmit/py/pw_presubmit/tools.py index 5fa3a4b82..644cabb95 100644 --- a/pw_presubmit/py/pw_presubmit/tools.py +++ b/pw_presubmit/py/pw_presubmit/tools.py @@ -99,8 +99,14 @@ def git_diff_names(commit: str = 'HEAD', """Returns absolute paths of files changed since the specified commit.""" root = git_repo_path(repo=repo) return [ - os.path.abspath(os.path.join(root, path)) for path in git_stdout( - 'diff', '--name-only', commit, '--', *paths, repo=repo).split() + os.path.abspath(os.path.join(root, path)) + for path in git_stdout('diff', + '--name-only', + '--diff-filter=d', + commit, + '--', + *paths, + repo=repo).split() ]