@@ -140,6 +140,7 @@ printf "%s\\n" "\$*" >> ${os.quoted_path(rsync_trace)}
140140archive=0
141141delete_destination=0
142142exclude_root_github=0
143+ exclude_root_git=0
143144while [ "\$ #" -gt 0 ]; do
144145 case "\$ 1" in
145146 -a)
@@ -154,6 +155,10 @@ while [ "\$#" -gt 0 ]; do
154155 exclude_root_github=1
155156 shift
156157 ;;
158+ --exclude=/.git|--exclude=/.git/)
159+ exclude_root_git=1
160+ shift
161+ ;;
157162 --)
158163 shift
159164 break
@@ -195,12 +200,12 @@ for source_path in "\$@"; do
195200 case "\$ source_path" in
196201 */)
197202 mkdir -p -- "\$ destination_path"
198- if [ "\$ exclude_root_github" = 1 ]; then
203+ if [ "\$ exclude_root_github" = 1 ] || [ " \$ exclude_root_git" = 1 ] ; then
199204 for source_entry in "\$ {source_path}".[!.]* "\$ {source_path}"..?* "\$ {source_path}"*; do
200205 if [ ! -e "\$ source_entry" ] && [ ! -L "\$ source_entry" ]; then
201206 continue
202207 fi
203- if [ "\$ {source_entry##*/}" = ".github" ]; then
208+ if { [ "\$ exclude_root_github" = 1 ] && [ " \$ {source_entry##*/}" = ".github" ]; } || { [ " \$ exclude_root_git" = 1 ] && [ " \$ {source_entry##*/}" = ".git" ]; } ; then
204209 continue
205210 fi
206211 cp -a -- "\$ source_entry" "\$ destination_path/"
254259 assert trace_lines[i].starts_with(' ${option_prefix}${operation}'), trace_lines.str()
255260 }
256261 rsync_lines := (os.read_file(rsync_trace) or { panic(err) }).trim_space().split_into_lines()
257- assert rsync_lines.len == 7, rsync_lines.str()
258- assert rsync_lines[0].starts_with(' - a thirdparty/ tcc/ '), rsync_lines.str()
259- assert rsync_lines[1].starts_with(' - a -- delete -- exclude = / .github/ '), rsync_lines.str()
260- assert rsync_lines[2].contains(' thirdparty/ tcc.original/ .git/ '), rsync_lines.str()
261- assert rsync_lines[3].contains(' thirdparty/ tcc.original/ lib/ libgc '), rsync_lines.str()
262- assert rsync_lines[4].contains(' thirdparty/ tcc.original/ lib/ build'), rsync_lines.str()
263- assert rsync_lines[5].contains(' thirdparty/ tcc.original/ README.md'), rsync_lines.str()
264- assert rsync_lines[6].ends_with(' / build.sh'), rsync_lines.str()
262+ assert rsync_lines.len == 8, rsync_lines.str()
263+ assert rsync_lines[0].starts_with(' - a -- exclude = / .git -- exclude = / .git/ thirdparty/ tcc/ '), rsync_lines.str()
264+
265+ assert rsync_lines[1].starts_with(' - a thirdparty/ tcc/ '), rsync_lines.str()
266+ assert rsync_lines[2].starts_with(' - a -- delete -- exclude = / .github/ '), rsync_lines.str()
267+ assert rsync_lines[3].contains(' thirdparty/ tcc.original/ .git/ '), rsync_lines.str()
268+ assert rsync_lines[4].contains(' thirdparty/ tcc.original/ lib/ libgc '), rsync_lines.str()
269+ assert rsync_lines[5].contains(' thirdparty/ tcc.original/ lib/ build'), rsync_lines.str()
270+ assert rsync_lines[6].contains(' thirdparty/ tcc.original/ README.md'), rsync_lines.str()
271+ assert rsync_lines[7].ends_with(' / build.sh'), rsync_lines.str()
265272 assert os.execute(' ${os.quoted_path (os.join_path (tcc_dir, 'tcc.exe' ))} -- version').output.trim_space() == ' source- test- tcc '
266273 staged_source_workflow := os.join_path(root, ' tinycc ', ' thirdparty', ' tcc ', ' .github',
267274 ' workflows', ' preserve.yml')
0 commit comments