X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/7170ca8dba0a407cd0c91b41b48163c7b682abb1..refs/heads/master:/link-by-hash.diff diff --git a/link-by-hash.diff b/link-by-hash.diff index 1415923..53fff8f 100644 --- a/link-by-hash.diff +++ b/link-by-hash.diff @@ -12,7 +12,7 @@ To use this patch, run these commands for a successful build: ./configure make -based-on: 181c9faf928faad08ef095f4667afe460ec3bef6 +based-on: a01e3b490eb36ccf9e704840e1b6683dab867550 diff --git a/Makefile.in b/Makefile.in --- a/Makefile.in +++ b/Makefile.in @@ -28,7 +28,7 @@ diff --git a/Makefile.in b/Makefile.in diff --git a/flist.c b/flist.c --- a/flist.c +++ b/flist.c -@@ -73,6 +73,7 @@ extern int sender_keeps_checksum; +@@ -74,6 +74,7 @@ extern int sender_keeps_checksum; extern int unsort_ndx; extern struct stats stats; extern char *filesfrom_host; @@ -36,7 +36,7 @@ diff --git a/flist.c b/flist.c extern char *usermap, *groupmap; extern char curr_dir[MAXPATHLEN]; -@@ -891,7 +892,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist, +@@ -910,7 +911,7 @@ static struct file_struct *recv_file_entry(int f, struct file_list *flist, int x extra_len += EXTRA_LEN; #endif @@ -400,7 +400,7 @@ diff --git a/options.c b/options.c char *config_file = NULL; char *shell_cmd = NULL; char *logfile_name = NULL; -@@ -745,6 +746,7 @@ void usage(enum logcode F) +@@ -746,6 +747,7 @@ void usage(enum logcode F) rprintf(F," --compare-dest=DIR also compare destination files relative to DIR\n"); rprintf(F," --copy-dest=DIR ... and include copies of unchanged files\n"); rprintf(F," --link-dest=DIR hardlink to files in DIR when unchanged\n"); @@ -409,15 +409,15 @@ diff --git a/options.c b/options.c rprintf(F," --compress-level=NUM explicitly set compression level\n"); rprintf(F," --skip-compress=LIST skip compressing files with a suffix in LIST\n"); @@ -798,7 +800,7 @@ enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, + OPT_FILTER, OPT_COMPARE_DEST, OPT_COPY_DEST, OPT_LINK_DEST, OPT_HELP, OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, OPT_MIN_SIZE, OPT_CHMOD, OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_ONLY_WRITE_BATCH, OPT_MAX_SIZE, - OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, -- OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, -+ OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_LINK_BY_HASH, +- OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, ++ OPT_NO_D, OPT_APPEND, OPT_NO_ICONV, OPT_INFO, OPT_DEBUG, OPT_LINK_BY_HASH, + OPT_USERMAP, OPT_GROUPMAP, OPT_CHOWN, OPT_BWLIMIT, OPT_SERVER, OPT_REFUSED_BASE = 9000}; - static struct poptOption long_options[] = { -@@ -937,6 +939,7 @@ static struct poptOption long_options[] = { +@@ -938,6 +940,7 @@ static struct poptOption long_options[] = { {"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 }, {"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 }, {"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 }, @@ -425,7 +425,7 @@ diff --git a/options.c b/options.c {"fuzzy", 'y', POPT_ARG_VAL, &fuzzy_basis, 1, 0, 0 }, {"no-fuzzy", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 }, {"no-y", 0, POPT_ARG_VAL, &fuzzy_basis, 0, 0, 0 }, -@@ -1743,6 +1746,21 @@ int parse_arguments(int *argc_p, const char ***argv_p) +@@ -1764,6 +1767,21 @@ int parse_arguments(int *argc_p, const char ***argv_p) return 0; #endif @@ -447,7 +447,7 @@ diff --git a/options.c b/options.c default: /* A large opt value means that set_refuse_options() * turned this option off. */ -@@ -2601,6 +2619,11 @@ void server_options(char **args, int *argc_p) +@@ -2636,6 +2654,11 @@ void server_options(char **args, int *argc_p) } else if (inplace) args[ac++] = "--inplace"; @@ -462,7 +462,7 @@ diff --git a/options.c b/options.c diff --git a/receiver.c b/receiver.c --- a/receiver.c +++ b/receiver.c -@@ -164,11 +164,13 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file) +@@ -196,11 +196,13 @@ int open_tmpfile(char *fnametmp, const char *fname, struct file_struct *file) } static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, @@ -477,7 +477,7 @@ diff --git a/receiver.c b/receiver.c int32 len; OFF_T offset = 0; OFF_T offset2; -@@ -188,6 +190,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, +@@ -220,6 +222,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, } else mapbuf = NULL; @@ -487,7 +487,7 @@ diff --git a/receiver.c b/receiver.c sum_init(checksum_seed); if (append_mode > 0) { -@@ -232,6 +237,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, +@@ -264,6 +269,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, cleanup_got_literal = 1; sum_update(data, i); @@ -496,7 +496,7 @@ diff --git a/receiver.c b/receiver.c if (fd != -1 && write_file(fd,data,i) != i) goto report_write_error; -@@ -258,6 +265,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, +@@ -290,6 +297,8 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, see_token(map, len); sum_update(map, len); @@ -505,7 +505,7 @@ diff --git a/receiver.c b/receiver.c } if (updating_basis_or_equiv) { -@@ -305,6 +314,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, +@@ -337,6 +346,9 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, if (sum_end(file_sum1) != checksum_len) overflow_exit("checksum_len"); /* Impossible... */ @@ -515,7 +515,7 @@ diff --git a/receiver.c b/receiver.c if (mapbuf) unmap_file(mapbuf); -@@ -319,7 +331,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, +@@ -351,7 +363,7 @@ static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r, static void discard_receive_data(int f_in, OFF_T length) { @@ -524,27 +524,27 @@ diff --git a/receiver.c b/receiver.c } static void handle_delayed_updates(char *local_name) -@@ -744,7 +756,7 @@ int recv_files(int f_in, char *local_name) +@@ -779,7 +791,7 @@ int recv_files(int f_in, int f_out, char *local_name) /* recv file data */ recv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size, - fname, fd2, F_LENGTH(file)); + fname, fd2, F_LENGTH(file), F_SUM(file)); - log_item(log_code, file, &initial_stats, iflags, NULL); + log_item(log_code, file, iflags, NULL); diff --git a/rsync.c b/rsync.c --- a/rsync.c +++ b/rsync.c -@@ -48,6 +48,7 @@ extern int flist_eof; - extern int msgs2stderr; +@@ -49,6 +49,7 @@ extern int flist_eof; + extern int file_old_total; extern int keep_dirlinks; extern int make_backups; +extern char *link_by_hash_dir; extern struct file_list *cur_flist, *first_flist, *dir_flist; extern struct chmod_mode_struct *daemon_chmod_modes; #ifdef ICONV_OPTION -@@ -575,8 +576,15 @@ int finish_transfer(const char *fname, const char *fnametmp, +@@ -644,8 +645,15 @@ int finish_transfer(const char *fname, const char *fnametmp, /* move tmp file over real file */ if (DEBUG_GTE(RECV, 1)) rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname); @@ -565,7 +565,7 @@ diff --git a/rsync.c b/rsync.c diff --git a/rsync.h b/rsync.h --- a/rsync.h +++ b/rsync.h -@@ -854,6 +854,14 @@ struct stats { +@@ -865,6 +865,14 @@ struct stats { int xferred_files; };