~bigbes/sourcehut-root

ref: 6d2d8535556013c93c04f7cceb1f2e00eab66d7d sourcehut-root/.clone-repos.sh -rw-r--r-- 1.3 KiB
6d2d8535 — Eugene Blikh patches: ubuntu/genimg — widen systemd-networkd match to Name=en* 8 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
# Clone all sourcehut-related repos and check out the latest tag.
set -u

REPOS=(
  sr.ht-apkbuilds
  builds.sr.ht
  git.sr.ht
  sr.ht-docs
  sr.ht-nginx
  core-go
  meta.sr.ht
  todo.sr.ht
  core.sr.ht
  go-away-config
  gensokyo
  status.sr.ht
  hub.sr.ht
  lists.sr.ht
  man.sr.ht
  paste.sr.ht
  sourcehut-ssh
  pages.sr.ht
  git-send-email.io
  sourcehut.org
  sourcehut-migrate
  srht.site
  api.sr.ht
  sr.ht-pkgbuilds
  sourcehut-go
  forgeperf
  gql.sr.ht
  git-am.io
  git-rebase.io
)

clone_one() {
  local name="$1"
  local url="https://git.sr.ht/~sircmpwn/$name"
  local log="/tmp/srht-clone-$name.log"

  if [ -d "$name/.git" ]; then
    echo "SKIP   $name (already cloned)"
    return 0
  fi

  if ! git clone --quiet "$url" "$name" >"$log" 2>&1; then
    echo "FAIL   $name (clone)"
    return 1
  fi

  local tag
  tag=$(git -C "$name" tag --sort=-v:refname 2>/dev/null | head -n1)
  if [ -z "$tag" ]; then
    local branch
    branch=$(git -C "$name" rev-parse --abbrev-ref HEAD)
    echo "NOTAG  $name (on $branch)"
    return 0
  fi

  if git -C "$name" -c advice.detachedHead=false checkout --quiet "$tag" 2>>"$log"; then
    echo "OK     $name @ $tag"
  else
    echo "FAIL   $name (checkout $tag)"
  fi
}

export -f clone_one

printf '%s\n' "${REPOS[@]}" | xargs -n1 -P6 -I{} bash -c 'clone_one "{}"'