What's cooking (2014/02 #03)
[alt-git.git] / WC
blob75298e88af263e3a5f34ffc5f7da8d64be79e9fb
1 #!/bin/sh
2 # Prepare "What's cooking in git.git"
4 master_at=$(git rev-parse --verify refs/heads/master)
5 next_at=$(git rev-parse --verify refs/heads/next)
7 keep_master=
8 case "$1" in
9 generate)
10 echo Here are the topics that have been
11 echo
12 Meta/git-topic.perl --base=master | sed -e 's/^\*./\n*/'
13 exit
15 keep)
16 keep_master=--keep-master
18 esac
20 eval $(LC_ALL=C date +"monthname=%b month=%m year=%Y date=%d dow=%a")
22 lead="whats/cooking/$year/$month"
23 issue=$(
24 cd Meta &&
25 git ls-tree -r --name-only HEAD "$lead" | tail -n 1
27 if test -n "$issue"
28 then
29 issue=$( expr "$issue" : '.*/0*\([1-9][0-9]*\)\.txt$' )
30 issue=$(( $issue + 1 ))
31 else
32 issue=1
34 issue=$( printf "%02d" $issue )
35 mkdir -p "Meta/$lead"
37 exec >"Meta/$lead/$issue.txt"
39 cat <<EOF
40 To: git@vger.kernel.org
41 Subject: What's cooking in git.git ($monthname $year, #$issue; $dow, $date)
42 X-master-at: $master_at
43 X-next-at: $next_at
45 What's cooking in git.git ($monthname $year, #$issue; $dow, $date)
46 --------------------------------------------------
48 EOF
50 last=$(
51 cd Meta &&
52 git ls-tree -r --name-only HEAD "whats/cooking" | tail -n 1
55 sed -e 's/^\[New Topics\]$/[Old New Topics]/' "Meta/$last" |
56 Meta/UWC $keep_master