-@@ -185,6 +296,8 @@ static enum delret delete_item(char *fna
- /* Prep directory is to be deleted, so delete all its contents. Note
- * that fname must point to a MAXPATHLEN buffer! (The buffer is used
- * for recursion, but returned unchanged.)
+ * Note that fname must point to a MAXPATHLEN buffer if the mode indicates it's
+ * a directory! (The buffer is used for recursion, but returned unchanged.)
++ *
++ * Also note: --detect-rename may use this routine with DEL_NO_DELETIONS set!
+ */
+ static enum delret delete_item(char *fname, int mode, char *replace, int flags)
+ {
+@@ -146,6 +259,8 @@ static enum delret delete_item(char *fna
+ goto check_ret;
+ /* OK: try to delete the directory. */
+ }
++ if (flags & DEL_NO_DELETIONS)
++ return DR_SUCCESS;
+
+ if (!replace && max_delete >= 0 && ++deletion_count > max_delete)
+ return DR_AT_LIMIT;
+@@ -192,6 +307,8 @@ static enum delret delete_item(char *fna
+ * its contents, otherwise just checks for content. Returns DR_SUCCESS or
+ * DR_NOT_EMPTY. Note that fname must point to a MAXPATHLEN buffer! (The
+ * buffer is used for recursion, but returned unchanged.)