blob: 43b284fdf4da40b8983a99c46fba7ebd6b9eaf46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#/bin/bash
for repository in /repositories/*; do
cd /repositories/$(basename "$repository")
gitinfoExists=$(git ls-tree HEAD -- .gitinfo 2>/dev/null)
# does gitinfo exist?
if [ -z "$gitinfoExists" ]; then
echo "No .gitinfo found for $(basename "$repository"). Blanking description."
echo "" > /repositories/$(basename "$repository")/description
continue
fi
gitinfoContents=$(git cat-file -p @:.gitinfo)
# extract description from gitinfo (json format)
description=$(echo "$gitinfoContents" | grep -oP '"description":\s*"\K[^"]+')
# write description to repository description file
echo "$description" > /repositories/$(basename "$repository")/description
done
|