summaryrefslogtreecommitdiff
path: root/common
blob: ff9dad619883e30b41ff02eea806cdb0fd1ad6cf (plain)
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
#!/hint/bash

alpine_keys=(
  'NICKNAME'
  'FN'
  'EMAIL'
  'FCC'
  'COMMENT'
)

keys=(
  'UID'
  "${alpine_keys[@]}"
  'REV'
)

gen_rev() {
  printf 'REV:%s\n' "$(
    date -u -Iseconds \
    | sed 's@+00:00$@Z@'
  )"
}

find_vcs() {
  {
    find "${git_dir}" \
      -name '.git' \
      -prune \
      , \
      -type f \
      -name '*.vcs' \
      -printf '%p\n'
    git -C "${git_dir}" archive HEAD \
    | tar -t \
    | sed '
      /\.vcs$/!d
      s@^@'"${git_dir%/}"'/@
    '
  } \
  | sort -u
}

git_dir="$1"

if [ ! -d "${git_dir}" ]; then
  >&2 printf 'invalid git dir: "%s"\n' "${git_dir}"
  exit 1
fi