Project

General

Profile

« Previous | Next » 

Revision 9890

bugfix: lib/sh/sync.sh: upload(): only add `--exclude="**"` if there are --includes. this enables running upload() without paths to upload all files.

View differences:

lib/sh/sync.sh
11 11
	echo_func; kw_params local_dir remote_url swap
12 12
	
13 13
	# change path args to --includes
14
	local args=()
14
	local has_includes= args=()
15 15
	local a; for a in "$@"; do
16 16
		if starts_with -- "$a"; then args+=("$a") # option, so leave as is
17 17
		else # path
18 18
			# also need to --include parent dirs for each --include path
19 19
			path_parents "$(base_dir="$local_dir" canon_rel_path "$a")"
20 20
			args+=("${dirs[@]/#/--include=/}") # prepend each with --include=/
21
			has_includes=1
21 22
		fi
22 23
	done
23
	set -- "${args[@]}"
24
	set -- "${args[@]}" ${has_includes:+--exclude="**"}
24 25
	
25
	src="$local_dir" dest="$remote_url" command put "$@" --exclude="**"
26
	src="$local_dir" dest="$remote_url" command put "$@"
26 27
}
27 28

  
28 29
download() { echo_func; swap=1 upload; } # usage: see upload()

Also available in: Unified diff