Commit Graph

347 Commits

Author SHA1 Message Date
Wayne Davison
0f0b2e66b8 Simplified the last change a bit. 2005-05-27 18:15:18 +00:00
Wayne Davison
3a05c5d3ce If we unduplicate '.', make sure we also copy FLAG_DEL_HERE (in
addition to FLAG_TOP_DIR), so that the unduplication of a real
dir and an implied dir (implied by --relative) works right.
2005-05-27 18:04:04 +00:00
Wayne Davison
cbb5fa4f07 Handle nested "." dirs (caused by --relative and a trailing slash or
a trailing "/.") in f_name_cmp() when dirname is not an identical
pointer.
2005-05-25 01:24:01 +00:00
Wayne Davison
a289f89fbe Treat a trailing ".." dir-name as if "../" had been specified so
that we don't use the name in the destination path and save files
into a higher destination directory.
2005-05-14 18:44:57 +00:00
Wayne Davison
557a35f55b If adding a trailing dot to a directory name overflows
MAXPATHLEN, die with an overflow error.
2005-05-13 22:02:24 +00:00
Wayne Davison
7a16e12207 If the user specified --relative and a source dir with a trailing
slash, make sure we strip of the trailing "/." from the dir's len
(in del_hier_name_len) so that its subdirs get marked with
FLAG_DEL_HERE.
2005-04-27 22:56:47 +00:00
Wayne Davison
7b558d7f8b Fixed a comment. 2005-03-30 17:31:35 +00:00
Wayne Davison
53135fe89a Changed maybe_emit_filelist_progress() and emit_filelist_progress()
to take an integer count instead of a struct file_list so that we
can pass in a file-list-count offset for delete's separate calls
to send_directory().
2005-03-29 10:57:31 +00:00
Wayne Davison
301fb56ce9 Split the conditional-directory sending out of send_file_name() into
a new function: send_if_directory().  This lets the code that is
recursively descending through the directories make its list of a
dir's contents and close the DIR handle before recursing into the
subdirs.  Also, the "recurse" var is just true/false once again.
2005-03-14 17:30:15 +00:00
Wayne Davison
a98ad81760 Got rid of some code in f_name_cmp() that tried to make all the
dirname pointers to equivalent strings have identical pointers.
2005-03-14 03:36:56 +00:00
Wayne Davison
d64e6f42b4 Use the new "the_file_list" global. 2005-03-03 18:44:42 +00:00
Wayne Davison
32cbfe7b17 - Moved file-deletion code into generator.c.
- Made filesystem_dev a global that the generator can set during its
  delete pass.
- Fixed an off-by-one boundary check in send_directory().
- Added an arg to get_dirlist() so that delete_in_dir() can call it
  efficiently.
2005-02-26 18:03:46 +00:00
Wayne Davison
89d19eedef Call log_delete() from delete_file() anytime that DEL_TERSE is
not set (we used to only call if verbose or log_format were also
set).
2005-02-26 04:50:55 +00:00
Wayne Davison
d17190df44 Don't add st_size from a device to stats.total_size. 2005-02-25 20:28:27 +00:00
Wayne Davison
87fd439059 When preforming a recursive delete, push/pop the per-dir merge rules. 2005-02-22 20:42:55 +00:00
Wayne Davison
564ef546a9 Sort the dir-list returned by get_dirlist() and the dir-list that
delete_in_dir() generates.
2005-02-22 03:37:18 +00:00
Wayne Davison
94dcbf8367 - Iterate through the deletion list in reverse order so that we
can't delete a backup file that we just created.
- The rename-directory-for-backup heuristic now checks the
  DEL_FORCE_RECURSE flag, not the zap_dir variable.  We also set
  the flag when we recurse so that only the root dir of a deleted
  hierarchy can be missing the flag (and thus be a call from the
  generator).
2005-02-22 03:16:41 +00:00
Wayne Davison
1bad11c759 Only rename a directory with the backup suffix if we're removing
it to replace it with a file of the same name.
2005-02-22 01:59:15 +00:00
Wayne Davison
e1ad7fe63d A couple changes in delete_file() make us more compatible with
older versions: (1) we no longer complain if excluded files
sticking around cause us to not be able to remove a subdir, and
(2) we output the name of the removed subdir after it has been
successfully removed.
2005-02-22 00:42:12 +00:00
Wayne Davison
34e18ecd61 - Moved delete_file() here from rsync.c and improved it to avoid
removing files we just backed up to the current directory and to
  rename a non-empty dir to dir~ (when no backup-dir is specified).
- Made delete_missing() static.
2005-02-21 10:50:30 +00:00
Wayne Davison
8715db2cab Tweaked some externs. 2005-02-20 00:16:23 +00:00
Wayne Davison
e1f40891c7 - Needed to use a name buffer in delete_missing() to avoid having
a recursive delete reuse our buffer from f_name().
- Moved the backup-handling into delete_file() in rsync.c.
- Moved the --max-delete counting into delete_file() in rsync.c.
2005-02-19 23:41:52 +00:00
Wayne Davison
7448177753 - Call log_delete() instead of outputting a "deleting ..." message.
- Call delete_file() with its new arg.
2005-02-19 02:39:15 +00:00
Wayne Davison
37802f40dc - If send_file_name() gets f set to -2, it skips the local filter rules.
- Added get_dirlist(), which returns a file_list structure for the
  desired directory, optionally with local filter rules disabled.
2005-02-14 02:41:23 +00:00
Wayne Davison
bf0c5bec45 If f_name_cmp() discovers that two directory strings compare to an
equal value without being equal pointers, substitute one of the
pointers for the other in the file list.  This optimizes future name
comparisons.  Note also that this optimization won't be triggered
very often (because rsync tends to send the names grouped by dir-
name at transmission time), but it's nice to be able to assume that
all files in the same dir have identical dir-name pointers after the
qsort is finished.
2005-02-14 01:29:17 +00:00
Wayne Davison
4f5b0756df John E. Malmberg convinced me to standardize on #ifs for defined
values instead of non-zero.
2005-02-14 00:53:43 +00:00
Wayne Davison
fe1c19dcdf In clean_flist(), if a duplicate is found for a dir and a non-dir,
always dump the non-dir (because the dir might have contents in
the list).
2005-02-13 22:48:38 +00:00
Wayne Davison
f5db099330 - Made receive_file_entry() return the file_struct pointer instead
of storing it into the files[] array.
- Made flist_find() return "no match" if the found item differs in
  its directory-ness from the search item.
- Changed f_name_cmp() to sort sub-directories after non-directories
  for each directory's contents.  This makes things like the upcoming
  --fuzzy patch easier to get right.
- One complicating factor is that clean_flist() needed some extra
  code to ensure that a directory doesn't duplicate a non-directory
  of the same name.
- Make sure that the "strip_root" code in clean_flist() (for relative
  paths) strips off all leading slashes.
2005-02-13 21:15:47 +00:00
Wayne Davison
8824e2cee4 Changed the prefix on the fnc_state enums. 2005-02-13 10:23:56 +00:00
Wayne Davison
cc25d29132 We don't need to avoid the local filter list in send_file_name()
when --delete-excluded is set because our list has been trimmed to
only include rules that apply in the current mode.
2005-02-12 19:52:18 +00:00
Wayne Davison
134f43385b - Since send_file_list() is no longer called with f == -1, got rid
of all the conditional code to support that.
- Improved the comment before send_directory() to indicate that it
  gets called with f == -1 from delete_in_dir().
2005-02-12 18:40:15 +00:00
Wayne Davison
2f3cad893b - Decided that flist_find() should be public, not static.
- Modified f_name_cmp() so that, beginning with protocol 29,
  it will guarantee that a directory name will sort one slot
  before its contents (prior versions could sort other items
  in between in rare instances).
2005-02-09 02:36:17 +00:00
Wayne Davison
71903f601a Added missing calls to safe_fname() and full_fname(). 2005-02-07 20:40:18 +00:00
Wayne Davison
54b4059856 Needed to call safe_fname() when listing the remote names. 2005-02-07 19:40:31 +00:00
Wayne Davison
eb9b2e53c8 Changed delete_missing() to not limit the use of DEL_FORCE_RECURSE
to just --delete-during now that the other delete routines are using
delete_in_dir().
2005-02-03 19:19:39 +00:00
Wayne Davison
ee3751c8d7 - We now separate the user-specified top-dir flag (via the restored
FLAG_TOP_DIR) from the del-in-this-directory flag (FLAG_DEL_HERE).
  This was needed to properly handle -x in delete_in_dir().
- The delete_in_dir() function takes a slightly changed set of args.
- Always set the FLAG_DEL_HERE flags, not just for --delete-during.
2005-02-03 02:01:17 +00:00
Wayne Davison
14698a3a1a - Moved an optimization from file_compare() into f_name_cmp() (the one
that avoids doing a string-compare on two identical char pointers),
  making it just a wrapper for f_name_cmp().  Also made file_compare()
  static because everyone now calls f_name_cmp() directly.
- Improved the flist summary that is output at high verbosity.
- Improved delete_in_dir() to better handle the push/pop semantics
  based on the depth value that is now passed in as an arg (so that
  we don't have to parse it out of the paths each time).
2005-02-03 01:18:58 +00:00
Wayne Davison
f3c3ed44e6 - Made flist_find() and receive_file_entry() static functions.
- Changed receive_file_entry() args.
- We now store the directory depth into file->dir.depth when
  receiving the file list.  This will be used to aid in the
  traversal of the file list on the receiving side for things
  such as the future --fuzzy option and better --delete-during
  processing.
- Fixed a bug when -R was used with "." as a source directory:
  subdirectories were not being promoted to FLAG_DEL_START when
  --delete-during was specified.
- Refer to the old basedir variable as dir.root.
- Got rid of the first-push code -- I decided that it wasn't
  the right thing to do for per-dir merge-file processing.
- Improved the flist_find() function to make it a little more
  optimal.  The new code no longer needs the inline function
  flist_up().
- In clean_flist() we now set two new values in the flist struct:
  "low" and "high".  These are used by the new flist_find().
- Tweaked the output_flist() function to output each entry's
  flags and to output the directory-depth on the receiving side
  in place of the directory-root (which is still output on the
  sending side).
2005-02-01 09:21:32 +00:00
Wayne Davison
42f23f479d Fixed a typo in a variable name. 2005-02-01 08:12:00 +00:00
Wayne Davison
4ccfd96cfe Tweaked one or more warning messages. 2005-01-31 19:13:19 +00:00
Wayne Davison
776b9d1c00 Added "need_first_push" logic to delete_in_dir(). 2005-01-30 20:24:11 +00:00
Wayne Davison
19b2a5d9fd delete_in_dir() now mananges the push/pop levels of nested
directories properly.
2005-01-30 10:01:21 +00:00
Wayne Davison
f1773e09ab - Now delete_in_dir() calls send_directory(), not send_file_name().
- Moved the local-list push/pop code out of send_directory() so that
  the callers (send_file_name() and delete_in_dir()) can call the
  push/pop functions themselves.  This is in preparation for
  delete_in_dir() getting fully correct push/pop semantics (for
  its --delete-during handling of per-dir filter files).
2005-01-30 09:12:55 +00:00
Wayne Davison
45478cc79b - Improved the handling of -x with -K.
- Changed delete_in_dir() to only be used by the --delete-during
  option.
- Added delete_missing() that is used by both delete_files() and
  delete_in_dir().
- delete_files() still uses send_file_list(), but delete_in_dir()
  now uses send_file_name().
2005-01-29 22:35:44 +00:00
Wayne Davison
3db859e8b5 Don't set unsigned del_heir_name_len to -1 -- it's only used
if in_del_hier is non-zero, so it doesn't need to take on an
invalid value.
2005-01-28 21:03:50 +00:00
Wayne Davison
25ff04417e Use "#if" (not "#ifdef") for configure-defined macros. 2005-01-28 18:50:49 +00:00
Wayne Davison
31b4d25d10 Set the new stats.flist_buildtime and stats.flist_xfertime values. 2005-01-27 22:21:45 +00:00
Wayne Davison
217cc3b045 - The call to delete_file() needs DEL_NO_RECURSE when handling
delete_before or delete_after or --dry-run will report too
  many deletions.
- Changed DEL_RECURSE to DEL_FORCE_RECURSE.
2005-01-25 12:05:20 +00:00
Wayne Davison
7842418b7b Renamed several exclude-related functions/variables using new
filter terminology.
2005-01-25 10:39:14 +00:00
Wayne Davison
c7d970f782 The calls into the exclude system changed a little for the new --filter
option:
- The special handling for cvs_exclude went away.
- Call push_local_excludes() and pop_local_excludes() instead of fiddling
  with the (no longer present) local_exclude_list var.
2005-01-25 00:52:50 +00:00