Fix section detection in cook.sh
Junio C Hamano committed
Aug 23, 2009 at 15:15 UTC
08ddf0cc19f00163b3eb7a4b628f7660170b1a86
1 file changed
+19
-5
cook.sh
+19
-5
@@ -107,6 +107,22 @@ add_desc () {
107
description="$description $kind $others"
108
}
109
110
+show_topic () {
111
+ old=$1 new=$2
112
+
113
+ sed -n -e '/^ ..*/p' "$old" >"$tmp.old.nc"
114
+ sed -n -e '/^ ..*/p' "$new" >"$tmp.new.nc"
115
+ if cmp "$tmp.old.nc" "$tmp.new.nc" >/dev/null
116
+ then
117
+ cat "$old"
118
+ else
119
+ cat "$new"
120
+ echo "<<"
121
+ cat "$old"
122
+ echo ">>"
123
+ fi
124
+}
125
+
126
while read b
127
do
128
git rev-list --no-merges "master..$b"
@@ -230,7 +246,7 @@ perl -w -e '
246
$last_empty = 1;
247
next;
248
}
233
- if (/\[(.*)\]\s*$/) {
249
+ if (/^\[(.*)\]\s*$/) {
250
$section = $1;
251
$branch = undef;
252
next;
@@ -318,8 +334,6 @@ do
334
else
335
echo
336
fi
321
- cat "$tmp.output.$newserial"
322
- echo "<<"
323
- cat "$tmp.template.$oldserial"
324
- echo ">>"
337
+
338
+ show_topic "$tmp.template.$oldserial" "$tmp.output.$newserial"
339
done <"$tmp.template.toc"