diff options
Diffstat (limited to 'scripts/gitinfo.bash')
| -rw-r--r-- | scripts/gitinfo.bash | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/gitinfo.bash b/scripts/gitinfo.bash new file mode 100644 index 0000000..e4b089f --- /dev/null +++ b/scripts/gitinfo.bash @@ -0,0 +1,18 @@ +#/bin/bash + +for repository in /repositories/*; do + cd /repositories/$(basename "$repository") + gitinfo=$(git cat-file -p @:.gitinfo) + + # does gitinfo exist? expect "fatal" if not + if [[ $gitinfo == fatal* ]]; then + echo "No .gitinfo found for $(basename "$repository")" + continue + fi + + # extract description from gitinfo (json format) + description=$(echo "$gitinfo" | grep -oP '"description":\s*"\K[^"]+') + + # write description to repository description file + echo "$description" > /repositories/$(basename "$repository")/description +done
\ No newline at end of file |
