pre-upload: deleting files counts as modifying a project

When making a single commit that touches more than one project, it's
possible to delete files from one while adding to another. The
presubmits should notice this and avoid complaining about the choice of
subject prefix. Today, we ignore the deleted files and suggest using the
other prefix.

TEST=unittests; also ran on real CL that deletes from
     platform2/userfeedback and adds to platform2/debugd/

Change-Id: I0367ece39fe82ff05e798a53222c715a87fc9427
Signed-off-by: Brian Norris <>
Reviewed-by: Chirantan Ekbote <>
Reviewed-by: Mike Frysinger <>
diff --git a/ b/
index 74cdda4..ead2edb 100755
--- a/
+++ b/
@@ -1384,7 +1384,7 @@
 def _check_project_prefix(_project, commit):
   """Require the commit message have a project specific prefix as needed."""
-  files = _get_affected_files(commit, relative=True)
+  files = _get_affected_files(commit, include_deletes=True, relative=True)
   prefix = os.path.commonprefix(files)
   prefix = os.path.dirname(prefix)