Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add the --backup-whole-dirs option to add the --suffix to deleted dirs as well
[rsync/rsync.git]
/
generator.c
diff --git
a/generator.c
b/generator.c
index
8557740
..
a97ce20
100644
(file)
--- a/
generator.c
+++ b/
generator.c
@@
-182,7
+182,9
@@
static enum delret delete_item(char *fbuf, uint16 mode, uint16 flags)
--file_extra_cnt;
uid_ndx = 0;
}
--file_extra_cnt;
uid_ndx = 0;
}
- if (ret == DR_NOT_EMPTY || ret == DR_AT_LIMIT)
+ /* In Peach's use case, we want to move a deleted directory
+ * even if it contains (protected) previous backup files. */
+ if (make_backups < 2 && (ret == DR_NOT_EMPTY || ret == DR_AT_LIMIT))
goto check_ret;
/* OK: try to delete the directory. */
}
goto check_ret;
/* OK: try to delete the directory. */
}
@@
-190,12
+192,14
@@
static enum delret delete_item(char *fbuf, uint16 mode, uint16 flags)
if (!(flags & DEL_MAKE_ROOM) && max_delete >= 0 && ++deletion_count > max_delete)
return DR_AT_LIMIT;
if (!(flags & DEL_MAKE_ROOM) && max_delete >= 0 && ++deletion_count > max_delete)
return DR_AT_LIMIT;
- if (S_ISDIR(mode)) {
- what = "rmdir";
- ok = do_rmdir(fbuf) == 0;
- } else if (make_backups > 0 && (backup_dir || !is_backup_file(fbuf))) {
+ if (make_backups > 0 && (backup_dir || !is_backup_file(fbuf))
+ /* Allow a dir to be backed up as a whole? */
+ && (make_backups >= 2 || !S_ISDIR(mode))) {
what = "make_backup";
ok = make_backup(fbuf);
what = "make_backup";
ok = make_backup(fbuf);
+ } else if (S_ISDIR(mode)) {
+ what = "rmdir";
+ ok = do_rmdir(fbuf) == 0;
} else {
what = "unlink";
ok = robust_unlink(fbuf) == 0;
} else {
what = "unlink";
ok = robust_unlink(fbuf) == 0;