+ * 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)
+ {
+@@ -140,6 +253,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;
+@@ -185,6 +300,8 @@ static enum delret delete_item(char *fna