Commit | Line | Data |
---|---|---|
92bf9171 | 1 | --- generator.c 18 May 2004 08:50:17 -0000 1.85 |
5e549c8f | 2 | +++ generator.c 5 Jun 2004 15:33:38 -0000 |
92bf9171 WD |
3 | @@ -26,6 +26,7 @@ |
4 | extern int verbose; | |
5 | extern int dry_run; | |
6 | extern int relative_paths; | |
7 | +extern int keep_dirlinks; | |
8 | extern int preserve_links; | |
9 | extern int am_root; | |
10 | extern int preserve_devices; | |
5e549c8f WD |
11 | @@ -302,6 +303,15 @@ void recv_generator(char *fname, struct |
12 | return; | |
13 | } | |
92bf9171 | 14 | |
5e549c8f WD |
15 | +#if SUPPORT_LINKS |
16 | + if (statret == 0 && keep_dirlinks | |
17 | + && S_ISLNK(st.st_mode) && S_ISDIR(file->mode)) { | |
18 | + STRUCT_STAT st2; | |
19 | + if (do_stat(fname, &st2) == 0 && S_ISDIR(st2.st_mode)) | |
20 | + st = st2; | |
21 | + } | |
22 | +#endif | |
23 | + | |
24 | if (statret == 0 && | |
25 | !preserve_perms && | |
26 | (S_ISDIR(st.st_mode) == S_ISDIR(file->mode))) { | |
92bf9171 | 27 | --- options.c 27 May 2004 21:51:53 -0000 1.153 |
5e549c8f | 28 | +++ options.c 5 Jun 2004 15:33:38 -0000 |
92bf9171 WD |
29 | @@ -38,6 +38,7 @@ int make_backups = 0; |
30 | int whole_file = -1; | |
31 | ||
32 | int archive_mode = 0; | |
33 | +int keep_dirlinks = 0; | |
34 | int copy_links = 0; | |
35 | int preserve_links = 0; | |
36 | int preserve_hard_links = 0; | |
5e549c8f WD |
37 | @@ -232,6 +233,7 @@ void usage(enum logcode F) |
38 | rprintf(F," --backup-dir make backups into this directory\n"); | |
92bf9171 WD |
39 | rprintf(F," --suffix=SUFFIX backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX); |
40 | rprintf(F," -u, --update update only (don't overwrite newer files)\n"); | |
92bf9171 | 41 | + rprintf(F," -K, --keep-dirlinks treat symlinked dir on receiver as dir\n"); |
5e549c8f | 42 | rprintf(F," -l, --links copy symlinks as symlinks\n"); |
92bf9171 WD |
43 | rprintf(F," -L, --copy-links copy the referent of all symlinks\n"); |
44 | rprintf(F," --copy-unsafe-links copy the referent of \"unsafe\" symlinks\n"); | |
92bf9171 WD |
45 | @@ -338,6 +340,7 @@ static struct poptOption long_options[] |
46 | {"sparse", 'S', POPT_ARG_NONE, &sparse_files, 0, 0, 0 }, | |
47 | {"cvs-exclude", 'C', POPT_ARG_NONE, &cvs_exclude, 0, 0, 0 }, | |
48 | {"update", 'u', POPT_ARG_NONE, &update_only, 0, 0, 0 }, | |
49 | + {"keep-dirlinks", 'K', POPT_ARG_NONE, &keep_dirlinks, 0, 0, 0 }, | |
50 | {"links", 'l', POPT_ARG_NONE, &preserve_links, 0, 0, 0 }, | |
51 | {"copy-links", 'L', POPT_ARG_NONE, ©_links, 0, 0, 0 }, | |
52 | {"whole-file", 'W', POPT_ARG_VAL, &whole_file, 1, 0, 0 }, | |
53 | @@ -818,6 +821,8 @@ void server_options(char **args,int *arg | |
54 | argstr[x++] = 'l'; | |
55 | if (copy_links) | |
56 | argstr[x++] = 'L'; | |
57 | + if (keep_dirlinks && am_sender) | |
58 | + argstr[x++] = 'K'; | |
59 | ||
60 | if (whole_file > 0) | |
61 | argstr[x++] = 'W'; | |
62 | --- rsync.yo 21 May 2004 09:44:32 -0000 1.170 | |
5e549c8f | 63 | +++ rsync.yo 5 Jun 2004 15:33:39 -0000 |
92bf9171 WD |
64 | @@ -289,6 +289,7 @@ verb( |
65 | --backup-dir make backups into this directory | |
66 | --suffix=SUFFIX backup suffix (default ~ w/o --backup-dir) | |
67 | -u, --update update only (don't overwrite newer files) | |
68 | + -K, --keep-dirlinks treat symlinked dir on receiver as dir | |
69 | -l, --links copy symlinks as symlinks | |
70 | -L, --copy-links copy the referent of all symlinks | |
71 | --copy-unsafe-links copy the referent of "unsafe" symlinks | |
72 | @@ -479,6 +480,10 @@ symlink where the destination has a file | |
73 | regardless of the timestamps. This might change in the future (feel | |
74 | free to comment on this on the mailing list if you have an opinion). | |
75 | ||
76 | +dit(bf(-K, --keep-dirlinks)) On the receiving side, if a symlink is | |
77 | +pointing to a directory, it will be treated as matching a directory | |
78 | +from the sender. | |
79 | + | |
80 | dit(bf(-l, --links)) When symlinks are encountered, recreate the | |
81 | symlink on the destination. | |
82 |