Revision 12955
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/lib/sh/sync.sh | ||
---|---|---|
22 | 22 |
fi |
23 | 23 |
|
24 | 24 |
# change path args to --includes |
25 |
local has_includes= args=() |
|
25 |
local has_includes= only_explicit_files=1 args=()
|
|
26 | 26 |
local a; for a in "$@"; do |
27 | 27 |
if starts_with -- "$a"; then args+=("$a") # option, so leave as is |
28 | 28 |
else # path |
... | ... | |
30 | 30 |
path_parents "$(base_dir="$local_dir" canon_dir_rel_path "$a")" |
31 | 31 |
args+=("${dirs[@]/#/--include=/}") # prepend each with --include=/ |
32 | 32 |
has_includes=1 |
33 |
if ! could_be_file "$a"; then only_explicit_files=; fi |
|
33 | 34 |
fi |
34 | 35 |
done |
36 |
if test ! "$has_includes"; then only_explicit_files=; fi #root dir->not file |
|
35 | 37 |
set -- "${args[@]}" ${has_includes:+--exclude="**"} |
36 | 38 |
|
37 |
# use .rsync_ignore |
|
38 |
set -- --filter="dir-merge,- .rsync_ignore" "$@" |
|
39 |
if test ! "$only_explicit_files"; then # don't rsync-ignore explicit files |
|
40 |
# use .rsync_ignore |
|
41 |
set -- --filter="dir-merge,- .rsync_ignore" "$@" |
|
42 |
|
|
43 |
# use directional .rsync_filter |
|
44 |
local filter_type=upload; if test "$swap"; then filter_type=download; fi |
|
45 |
set -- --filter="dir-merge .rsync_filter.$(hostname -s).$filter_type" \ |
|
46 |
--filter="dir-merge .rsync_filter.$filter_type" "$@" |
|
47 |
fi |
|
39 | 48 |
|
40 |
# use directional .rsync_filter |
|
41 |
local filter_type=upload; if test "$swap"; then filter_type=download; fi |
|
42 |
set -- --filter="dir-merge .rsync_filter.$(hostname -s).$filter_type" \ |
|
43 |
--filter="dir-merge .rsync_filter.$filter_type" "$@" |
|
44 |
|
|
45 | 49 |
src="$local_dir" dest="$remote_url" command put "$@" |
46 | 50 |
} |
47 | 51 |
|
Also available in: Unified diff
bugfix: lib/sh/sync.sh: don't unintentionally rsync-ignore explicitly-specified files