3 tools_dir=$(dirname "$0")
4 # shellcheck source=/dev/null
5 . "$tools_dir/common.sh" ''
7 if [ "$1" = '-n' ]; then
9 last=$(tail -n1 "$SHA1_FILE" | cut -f1 -d$'\t')
10 start_from=$(awk -F '\t' '/^[^#]/ && $3 == "'"$last"'" {
13 while (/^#/ || $2 == "branch");
19 if [ "$1" = '-s' ]; then
22 if [ -z "$start_from" ]; then
23 printf '-s requires a start tree\n' 1>&2
31 awk -F '\t' '/^[^#]/ && $3 == "'"$1"'" { print $'"$2"'; }' "$CTRL_FILE"
41 if ! cd ../mmotm; then
42 printf 'Cannot chdir to ../mmotm\n' 1>&2
45 if ! rsync -az --partial --exclude '.git*' \
46 --exclude broken-out.tar.gz --delete \
47 ozlabs.org::akpm/mmotm/. .; then
49 printf 'Fetcing mmotm failed\n' 1>&2
53 if [ "$(git status --porcelain)" ]; then
54 git commit -m "$(head -n 1 .DATE)"
59 if ! [ "$trees" ]; then
60 trees=$(awk -F '\t' '/^[^#]/ && $2 != "branch" { print $3 }' "$CTRL_FILE")
63 for name in $trees; do
64 if [ -n "$start_from" ]; then
65 if [ "$name" = "$start_from" ]; then
72 type=$(get_field "$name" 2)
73 if ! [ "$type" ]; then
74 printf '%s: unknown tree\n' "$name" 1>&2
78 printf '%s: %s\n' "$name" "$type"
80 tfun=$(type -t "$fun")
81 if [ "$tfun" = 'function' ]; then