File tree Expand file tree Collapse file tree 4 files changed +73
-3
lines changed
Expand file tree Collapse file tree 4 files changed +73
-3
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ git config devcontainers-theme.show-dirty 1
66sudo chown -R $( whoami) : /home/vscode/.microsoft
77sudo chown -R $( whoami) : /mnt/data/
88
9- sudo chmod +x .devcontainer /clone-repos.sh
10- .devcontainer /clone-repos.sh
9+ sudo chmod +x scripts /clone-repos.sh
10+ scripts /clone-repos.sh
1111
1212dotnet tool install -g Aspire.Cli
1313dotnet dev-certs https --trust
Original file line number Diff line number Diff line change 11#! /bin/bash
22set -euo pipefail
33
4- MANIFEST=.devcontainer /repos.json
4+ MANIFEST=scripts /repos.json
55
66jq -c ' .groups[]' $MANIFEST | while read group; do
77 GROUP=$( echo $group | jq -r .name)
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -euo pipefail
4+
5+ ROOT_DIR=" /mnt/data/crucible"
6+ MAX_DEPTH=2
7+ FETCH_ARGS=(" $@ " )
8+
9+ if [[ ! -d " $ROOT_DIR " ]]; then
10+ echo " Directory not found: $ROOT_DIR " >&2
11+ exit 1
12+ fi
13+
14+ fetch_repository () {
15+ local dir=$1
16+ if git -C " $dir " rev-parse --is-inside-work-tree > /dev/null 2>&1 ; then
17+ echo " Fetching updates in $dir "
18+ git -C " $dir " fetch " ${FETCH_ARGS[@]} "
19+ return 0
20+ fi
21+ return 1
22+ }
23+
24+ # Traverse directories up to MAX_DEPTH and stop descending once a repo is fetched.
25+ traverse_directory () {
26+ local dir=$1
27+ local depth=$2
28+
29+ if fetch_repository " $dir " ; then
30+ return 0
31+ fi
32+
33+ if (( depth >= MAX_DEPTH )) ; then
34+ echo " Skipping $dir (not a git repository)"
35+ return 1
36+ fi
37+
38+ local repo_found=1
39+
40+ while IFS= read -r -d ' ' subdir; do
41+ if traverse_directory " $subdir " $(( depth + 1 )) ; then
42+ repo_found=0
43+ fi
44+ done < <(
45+ find " $dir " \
46+ -mindepth 1 \
47+ -maxdepth 1 \
48+ -type d \
49+ -not -path ' */.git*' \
50+ -print0
51+ )
52+
53+ if (( repo_found )) ; then
54+ echo " Skipping $dir (not a git repository)"
55+ return 1
56+ fi
57+
58+ return 0
59+ }
60+
61+ while IFS= read -r -d ' ' path; do
62+ traverse_directory " $path " 1
63+ done < <(
64+ find " $ROOT_DIR " \
65+ -mindepth 1 \
66+ -maxdepth 1 \
67+ -type d \
68+ -not -path ' */.git*' \
69+ -print0
70+ )
File renamed without changes.
You can’t perform that action at this time.
0 commit comments