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

keys=(
  'UID'
  'EMAIL'
  'FN'
  'NICKNAME'
  'FCC'
  'COMMENT'
  '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