1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-08 00:10:12 +01:00
fdroidserver/tools/commitupdates

46 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Commits updates to apps, allowing you to edit the commit messages
commands=()
while read line; do
if [[ "$line" == *M*metadata/*.txt ]]; then
file=${line##* }
while read l; do
[[ "$l" == "Auto Name:"* ]] && name=${l##*:}
done < "$file"
id=${file##*/}
id=${id%.txt*}
[ -d metadata/$id ] && extra=metadata/$id
[ -n "$name" ] && id="$name ($id)"
newbuild=0
while read l; do
if [[ "$l" == "+Build:"* ]]; then
newbuild=1
build=${l#*:}
version=${build%%,*}
build=${build#*,}
vercode=${build%%,*}
fi
done < <(git diff HEAD -- "$file")
if [ $newbuild -eq 0 ]
then
message="$id:"
else
message="Update $id to $version ($vercode)"
fi
commands+=("git commit -m '$message' -e -v -- $file $extra")
fi
done < <(git status --porcelain)
for cmd in "${commands[@]}"; do
eval "$cmd"
done