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