You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by kp...@apache.org on 2022/06/27 23:26:24 UTC

[tvm] branch main updated: Fix clear-stale-images.sh with multiple worktree. (#11921)

This is an automated email from the ASF dual-hosted git repository.

kparzysz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new ae2de20c15 Fix clear-stale-images.sh with multiple worktree. (#11921)
ae2de20c15 is described below

commit ae2de20c152deb541bb09cef20ceade7d1a1e532
Author: Andrew Reusch <ar...@gmail.com>
AuthorDate: Mon Jun 27 16:26:19 2022 -0700

    Fix clear-stale-images.sh with multiple worktree. (#11921)
    
    * Process substitution doesn't error out in bash.
---
 docker/clear-stale-images.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docker/clear-stale-images.sh b/docker/clear-stale-images.sh
index 1e1e4b86a4..1c09870956 100755
--- a/docker/clear-stale-images.sh
+++ b/docker/clear-stale-images.sh
@@ -66,13 +66,15 @@ for r in "${repositories[@]}"; do
         worktree="${r}"
     else
         worktree="$(cat "${r}/.git")"
+        worktree="${worktree##gitdir: }"
     fi
+    worktree_list=$(cd "${worktree}" && git worktree list --porcelain | grep '^worktree ')
     while read wt; do
         d="${wt:9:${#wt}}"  # strip "worktree " prefix
         for img in $(cat "${d}/Jenkinsfile" | grep -E '^ci_[a-z]+ = ' | sed -E "s/ci_[a-z]+ = '([^\"]*)'/\1/"); do
             used_images=( "${used_images[@]}" "${img}" )
         done
-    done < <(cd "${worktree}" && git worktree list --porcelain | grep '^worktree ')
+    done < <(echo -n "${worktree_list}")
 done
 
 declare -a to_rm