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
|
|
|
|
|
2013-09-06 23:36:10 +02:00
|
|
|
commands=()
|
|
|
|
|
2013-06-18 00:18:38 +02:00
|
|
|
while read line; do
|
2013-11-03 11:50:44 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
[ -d metadata/$id ] && extra=metadata/$id
|
|
|
|
|
2013-11-05 00:11:54 +01:00
|
|
|
name=
|
2013-11-03 11:50:44 +01:00
|
|
|
while read l; do
|
|
|
|
if [[ "$l" == "Auto Name:"* ]]; then
|
|
|
|
name=${l##*:}
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done < "$file"
|
|
|
|
|
2013-11-05 00:11:54 +01:00
|
|
|
[ -n "$name" ] && fullname="$name ($id)" || fullname=$id
|
2013-11-03 11:50:44 +01:00
|
|
|
|
|
|
|
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
|
2013-11-05 00:11:54 +01:00
|
|
|
message="$fullname:"
|
2013-10-30 20:17:56 +01:00
|
|
|
else
|
2013-11-05 00:11:54 +01:00
|
|
|
message="Update $fullname to $version ($vercode)"
|
2013-10-30 20:17:56 +01:00
|
|
|
fi
|
2013-09-06 23:36:10 +02:00
|
|
|
|
2013-11-03 11:50:44 +01:00
|
|
|
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
|
|
|
|
2013-09-06 23:36:10 +02:00
|
|
|
for cmd in "${commands[@]}"; do
|
2013-11-03 11:50:44 +01:00
|
|
|
eval "$cmd"
|
2013-09-06 23:36:10 +02:00
|
|
|
done
|
2013-09-06 23:28:11 +02:00
|
|
|
|