From: Wayne Davison Date: Sun, 23 Sep 2007 02:00:53 +0000 (+0000) Subject: Moved list-only output from flist.c to generator.c so that it works X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/6f0805f564a5f11e7e93d0b74ee907641c748d5b Moved list-only output from flist.c to generator.c so that it works properly even in inc_recurse mode. Got rid of double output, weird output order, and outputting of implied dirs w/--no-implied-dirs. --- diff --git a/flist.c b/flist.c index d08f1e35..1452d6c6 100644 --- a/flist.c +++ b/flist.c @@ -26,7 +26,6 @@ #include "io.h" extern int verbose; -extern int list_only; extern int am_root; extern int am_server; extern int am_daemon; @@ -172,35 +171,6 @@ void show_flist_stats(void) /* Nothing yet */ } -static void list_file_entry(struct file_struct *f) -{ - char permbuf[PERMSTRING_SIZE]; - double len; - - if (!F_IS_ACTIVE(f)) { - /* this can happen if duplicate names were removed */ - return; - } - - permstring(permbuf, f->mode); - len = F_LENGTH(f); - - /* TODO: indicate '+' if the entry has an ACL. */ - -#ifdef SUPPORT_LINKS - if (preserve_links && S_ISLNK(f->mode)) { - rprintf(FINFO, "%s %11.0f %s %s -> %s\n", - permbuf, len, timestring(f->modtime), - f_name(f, NULL), F_SYMLINK(f)); - } else -#endif - { - rprintf(FINFO, "%s %11.0f %s %s\n", - permbuf, len, timestring(f->modtime), - f_name(f, NULL)); - } -} - /* Stat either a symlink or its referent, depending on the settings of * copy_links, copy_unsafe_links, etc. Returns -1 on error, 0 on success. * @@ -2178,12 +2148,6 @@ struct file_list *recv_file_list(int f) if (verbose > 3) output_flist(flist); - if (list_only) { - int i; - for (i = flist->low; i <= flist->high; i++) - list_file_entry(flist->files[i]); - } - if (verbose > 2) rprintf(FINFO, "recv_file_list done\n"); diff --git a/generator.c b/generator.c index d93529cf..f711ffdb 100644 --- a/generator.c +++ b/generator.c @@ -1072,6 +1072,35 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx, return j; } +static void list_file_entry(struct file_struct *f) +{ + char permbuf[PERMSTRING_SIZE]; + double len; + + if (!F_IS_ACTIVE(f)) { + /* this can happen if duplicate names were removed */ + return; + } + + permstring(permbuf, f->mode); + len = F_LENGTH(f); + + /* TODO: indicate '+' if the entry has an ACL. */ + +#ifdef SUPPORT_LINKS + if (preserve_links && S_ISLNK(f->mode)) { + rprintf(FINFO, "%s %11.0f %s %s -> %s\n", + permbuf, len, timestring(f->modtime), + f_name(f, NULL), F_SYMLINK(f)); + } else +#endif + { + rprintf(FINFO, "%s %11.0f %s %s\n", + permbuf, len, timestring(f->modtime), + f_name(f, NULL)); + } +} + static int phase = 0; static int dflt_perms; @@ -1105,12 +1134,18 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx, int implied_dirs_are_missing = relative_paths && !implied_dirs && !inc_recurse; int del_opts = delete_mode || force_delete ? DEL_RECURSE : 0; - if (list_only) - return; - if (verbose > 2) rprintf(FINFO, "recv_generator(%s,%d)\n", fname, ndx); + if (list_only) { + if (S_ISDIR(file->mode) + && ((!implied_dirs && !(file->flags & FLAG_XFER_DIR)) + || (inc_recurse && ndx != cur_flist->ndx_start - 1))) + return; + list_file_entry(file); + return; + } + if (server_filter_list.head) { if (excluded_below >= 0) { if (F_DEPTH(file) > excluded_below