cook.sh: update to the single-file output
Junio C Hamano committed
Jan 4, 2010 at 23:48 UTC
99232dbf99a20ac88936ce6bf53833882b4ecdf9
1 file changed
+27
-29
cook.sh
+27
-29
@@ -27,13 +27,6 @@ format_branch () {
27
label="* $1 ($(git show -s --format="%ai" $1 | sed -e 's/ .*//')) $count commit"
28
test "$count" = 1 || label="${label}s"
29
30
- count=$(git rev-list "master..$1" | wc -l)
31
- mcount=$(git rev-list "maint..$1" | wc -l)
32
- if test $mcount = $count
33
- then
34
- label="$label."
35
- fi
36
-
30
echo "$label"
31
lasttimelabel=
32
lastfoundmerge=
@@ -198,33 +191,36 @@ do
191
done <"$tmp.branches" >"$tmp.output.toc"
192
193
eval $(date +"monthname=%b month=%m year=%Y date=%d dow=%a")
201
-lead="whats/cooking/$year/$month"
202
-issue=$(
194
+
195
+incremental=$(
196
cd Meta &&
204
- git ls-files "$lead" | tail -n 1
197
+ if git diff --quiet HEAD -- whats-cooking.txt >/dev/null
198
+ then
199
+ echo no
200
+ else
201
+ echo yes
202
+ fi
203
)
206
-if test -n "$issue"
204
+
205
+# Find the current issue
206
+eval $(sed -ne '/^Subject: /{
207
+ s/^Subject: What.s cooking in git.git (\([A-Z][a-z][a-z]\) \([0-9][0-9][0-9][0-9]\), #\([0-9][0-9]*\); [A-Z][a-z][a-z], [0-9][0-9])$/lastmon=\1 lastyear=\2 lastissue=\3/p
208
+ q
209
+}' Meta/whats-cooking.txt)
210
+if test "$monthname $year" = "$lastmon $lastyear"
211
then
208
- issue=$( expr "$issue" : '.*/0*\([1-9][0-9]*\)\.txt$' )
209
- issue=$(( $issue + 1 ))
212
+ if test "$incremental" = no
213
+ then
214
+ issue=$(( $lastissue + 1 ))
215
+ else
216
+ issue=$(( lastissue + 0 ))
217
+ fi
218
else
219
issue=1
220
fi
213
-issue=$( printf "%02d" $issue )
214
-mkdir -p "Meta/$lead"
221
216
-last=$(
217
- cd Meta &&
218
- git ls-files "whats/cooking" | tail -n 1
219
-)
220
-
221
-# We may have a half-written one already.
222
-incremental=no
223
-if test -f "Meta/$lead/$issue.txt"
224
-then
225
- last="$lead/$issue.txt"
226
- incremental=yes
227
-fi
222
+issue=$( printf "%02d" $issue )
223
+last=whats-cooking.txt
224
225
master_at=$(git rev-parse --verify refs/heads/master)
226
next_at=$(git rev-parse --verify refs/heads/next)
@@ -373,14 +369,16 @@ perl -w -e '
369
' <"$template" "$tmp" "$incremental"
370
371
tmpserial=$(
376
- tail -n 1 "$tmp.template.toc" | read branch serial section && echo $serial
372
+ tail -n 1 "$tmp.template.toc" |
373
+ read branch serial section &&
374
+ echo $serial
375
)
376
377
# Assemble them all
378
379
if test -z "$TO_STDOUT"
380
then
383
- exec >"Meta/$lead/$issue.txt"
381
+ exec >"Meta/whats-cooking.txt"
382
fi
383
384
if test -s "$tmp.template.blurb"