We don't ever need to send the --chmod option to the remote rsync.
[rsync/rsync.git] / options.c
index d34bacb..c704074 100644 (file)
--- a/options.c
+++ b/options.c
@@ -145,7 +145,6 @@ char *log_format = NULL;
 char *password_file = NULL;
 char *rsync_path = RSYNC_PATH;
 char *backup_dir = NULL;
-char *chmod_mode = NULL;
 char backup_dir_buf[MAXPATHLEN];
 int rsync_port = 0;
 int compare_dest = 0;
@@ -174,6 +173,7 @@ static int itemize_changes = 0;
 static int refused_delete, refused_archive_part, refused_compress;
 static int refused_partial, refused_progress, refused_delete_before;
 static int refused_inplace;
+static char *chmod_mode = NULL;
 static char *max_size_arg, *min_size_arg;
 static char partialdir_for_delayupdate[] = ".~tmp~";
 
@@ -425,7 +425,7 @@ static struct poptOption long_options[] = {
   {"chmod",            0,  POPT_ARG_STRING, &chmod_mode, 0, 0, 0 },
   {"ignore-times",    'I', POPT_ARG_NONE,   &ignore_times, 0, 0, 0 },
   {"size-only",        0,  POPT_ARG_NONE,   &size_only, 0, 0, 0 },
-  {"one-file-system", 'x', POPT_ARG_NONE,   &one_file_system, 0, 0, 0 },
+  {"one-file-system", 'x', POPT_ARG_NONE,   0, 'x', 0, 0 },
   {"update",          'u', POPT_ARG_NONE,   &update_only, 0, 0, 0 },
   {"existing",         0,  POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
   {"ignore-non-existing",0,POPT_ARG_NONE,   &ignore_non_existing, 0, 0, 0 },
@@ -471,7 +471,7 @@ static struct poptOption long_options[] = {
   {"partial-dir",      0,  POPT_ARG_STRING, &partial_dir, 0, 0, 0 },
   {"delay-updates",    0,  POPT_ARG_NONE,   &delay_updates, 0, 0, 0 },
   {"log-format",       0,  POPT_ARG_STRING, &log_format, 0, 0, 0 },
-  {"itemize-changes", 'i', POPT_ARG_NONE,   &itemize_changes, 0, 0, 0 },
+  {"itemize-changes", 'i', POPT_ARG_NONE,   0, 'i', 0, 0 },
   {"bwlimit",          0,  POPT_ARG_INT,    &bwlimit, 0, 0, 0 },
   {"backup",          'b', POPT_ARG_NONE,   &make_backups, 0, 0, 0 },
   {"backup-dir",       0,  POPT_ARG_STRING, &backup_dir, 0, 0, 0 },
@@ -878,6 +878,10 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                        usage(FINFO);
                        exit_cleanup(0);
 
+               case 'i':
+                       itemize_changes++;
+                       break;
+
                case 'v':
                        verbose++;
                        break;
@@ -887,6 +891,10 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                                quiet++;
                        break;
 
+               case 'x':
+                       one_file_system++;
+                       break;
+
                case OPT_SENDER:
                        if (!am_server) {
                                usage(FERROR);
@@ -1217,14 +1225,16 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
        }
 
        if (log_format) {
-               if (log_format_has(log_format, 'i'))
-                       log_format_has_i = 1;
+               if (am_server && log_format_has(log_format, 'I'))
+                       log_format_has_i = 2;
+               else if (log_format_has(log_format, 'i'))
+                       log_format_has_i = itemize_changes | 1;
                if (!log_format_has(log_format, 'b')
                 && !log_format_has(log_format, 'c'))
                        log_before_transfer = !am_server;
        } else if (itemize_changes) {
                log_format = "%i %n%L";
-               log_format_has_i = 1;
+               log_format_has_i = itemize_changes;
                log_before_transfer = !am_server;
        }
 
@@ -1453,8 +1463,11 @@ void server_options(char **args,int *argc)
                argstr[x++] = 'I';
        if (relative_paths)
                argstr[x++] = 'R';
-       if (one_file_system)
+       if (one_file_system) {
                argstr[x++] = 'x';
+               if (one_file_system > 1)
+                       argstr[x++] = 'x';
+       }
        if (sparse_files)
                argstr[x++] = 'S';
        if (do_compression)
@@ -1483,7 +1496,9 @@ void server_options(char **args,int *argc)
        /* The server side doesn't use our log-format, but in certain
         * circumstances they need to know a little about the option. */
        if (log_format && am_sender) {
-               if (log_format_has_i)
+               if (log_format_has_i > 1)
+                       args[ac++] = "--log-format=%i%I";
+               else if (log_format_has_i)
                        args[ac++] = "--log-format=%i";
                else if (log_format_has_o_or_i)
                        args[ac++] = "--log-format=%o";
@@ -1621,11 +1636,6 @@ void server_options(char **args,int *argc)
                }
        }
 
-       if (chmod_mode && !am_sender) {
-               args[ac++] = "--chmod";
-               args[ac++] = chmod_mode;
-       }
-
        if (files_from && (!am_sender || filesfrom_host)) {
                if (filesfrom_host) {
                        args[ac++] = "--files-from";