1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-17 18:50:11 +02:00
fdroidserver/fd-commit

76 lines
1.3 KiB
Plaintext
Raw Normal View History

2013-06-18 00:18:38 +02:00
#!/bin/bash
2013-09-18 00:11:35 +02:00
# Commits updates to apps, allowing you to edit the commit messages
commands=()
if [ ! -d metadata ]; then
[ -d ../metadata ] && cd .. || { echo "No metadata files found!"; exit 2; }
fi
2013-06-18 00:18:38 +02:00
while read line; do
if [[ "$line" == *M*metadata/*.txt ]]; then
file=${line##* }
id=${file##*/}
id=${id%.txt*}
if [ $# -gt 0 ]; then
found=false
for arg in "$@"; do
if [ "$id" == "$arg" ]; then
found=true
break
fi
done
$found || continue
fi
2013-12-11 17:18:09 +01:00
if [ -d metadata/$id ]; then
extra=metadata/$id
else
extra=
fi
2013-12-11 17:18:09 +01:00
name= autoname=
while read l; do
if [[ "$l" == "Auto Name:"* ]]; then
autoname=${l##*:}
elif [[ "$l" == "Name:"* ]]; then
name=${l##*:}
fi
done < "$file"
if [ -n "$name" ]; then
fullname="$name ($id)"
elif [ -n "$autoname" ]; then
fullname="$autoname ($id)"
else
fullname="$id"
fi
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="$fullname:"
else
message="Update $fullname to $version ($vercode)"
fi
commands+=("git commit -m '$message' -e -v -- $file $extra")
fi
2013-06-18 00:18:38 +02:00
done < <(git status --porcelain)
2013-07-02 14:39:56 +02:00
for cmd in "${commands[@]}"; do
eval "$cmd"
done