|
101 | 101 | #
|
102 | 102 | # [protocol "file"]
|
103 | 103 | # allow = always
|
104 |
| -# |
105 | 104 | # [url "file:///home/user/github/BRL-CAD/"]
|
106 | 105 | # insteadOf = https://github.com/BRL-CAD
|
107 | 106 | #
|
@@ -171,32 +170,41 @@ ALL_REPOS+=$ADD_REPOS
|
171 | 170 | # repositories. Keep going until we have everything
|
172 | 171 | while [ ! -z "${ADD_REPOS}" ]
|
173 | 172 | do
|
174 |
| - ((CURR_PAGE++)) |
175 |
| - # Append repos (curl) |
176 |
| - ADD_REPOS=$(curl -s ${ROOT_URL}$CURR_PAGE | grep html_url | awk 'NR%2 == 0' | cut -d ':' -f 2-3 | tr -d '",'); |
177 |
| - # Append repos (gh) |
178 |
| - #ADD_REPOS=$(gh api --method GET ${API_ROOT_URL}$CURR_PAGE | jq | grep html_url | awk 'NR%2 == 0' | cut -d ':' -f 2-3 | tr -d '",'); |
179 |
| - ALL_REPOS+=$ADD_REPOS |
| 173 | + ((CURR_PAGE++)) |
| 174 | + # Append repos (curl) |
| 175 | + ADD_REPOS=$(curl -s ${ROOT_URL}$CURR_PAGE | grep html_url | awk 'NR%2 == 0' | cut -d ':' -f 2-3 | tr -d '",'); |
| 176 | + # Append repos (gh) |
| 177 | + #ADD_REPOS=$(gh api --method GET ${API_ROOT_URL}$CURR_PAGE | jq | grep html_url | awk 'NR%2 == 0' | cut -d ':' -f 2-3 | tr -d '",'); |
| 178 | + ALL_REPOS+=$ADD_REPOS |
180 | 179 | done
|
181 | 180 |
|
182 | 181 | # Report how many were found.
|
183 | 182 | repo_cnt=0
|
184 | 183 | for ORG_REPO in ${ALL_REPOS}; do
|
185 |
| - repo_cnt=$((repo_cnt + 1)) |
| 184 | + repo_cnt=$((repo_cnt + 1)) |
186 | 185 | done
|
187 | 186 | echo "Found $repo_cnt repositories"
|
188 | 187 |
|
189 | 188 | # Clone all the repositories, or update them if they've been cloned previously.
|
190 | 189 | # Specify --mirror so all upstream data (tags, etc.) is also preserved
|
191 | 190 | for ORG_REPO in ${ALL_REPOS}; do
|
192 |
| - dirname=${ORG_REPO/https:\/\/github.com\/BRL-CAD\//} |
193 |
| - if [ -e ./${dirname}.git ]; then |
194 |
| - echo "Updating ${dirname}.git" |
195 |
| - # https://stackoverflow.com/a/6151419/2037687 |
196 |
| - cd ${dirname}.git && git remote update --prune && cd .. |
197 |
| - else |
198 |
| - echo "Mirror cloning ${ORG_REPO}.git" |
199 |
| - git clone --mirror ${ORG_REPO}.git; |
200 |
| - fi |
| 191 | + dirname=${ORG_REPO/https:\/\/github.com\/BRL-CAD\//} |
| 192 | + if [ -e ./${dirname}.git ]; then |
| 193 | + echo "Updating ${dirname}.git" |
| 194 | + # https://stackoverflow.com/a/6151419/2037687 |
| 195 | + cd ${dirname}.git && git remote update --prune && cd .. |
| 196 | + else |
| 197 | + echo "Mirror cloning ${ORG_REPO}.git" |
| 198 | + git clone --mirror ${ORG_REPO}.git; |
| 199 | + fi |
201 | 200 | done
|
202 | 201 |
|
| 202 | + |
| 203 | +# Local Variables: |
| 204 | +# tab-width: 8 |
| 205 | +# mode: sh |
| 206 | +# sh-indentation: 4 |
| 207 | +# sh-basic-offset: 4 |
| 208 | +# indent-tabs-mode: t |
| 209 | +# End: |
| 210 | +# ex: shiftwidth=4 tabstop=8 cino=N-s |
0 commit comments