]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Fix section detection in cook.sh
authorJunio C Hamano <gitster@pobox.com>
Sun, 23 Aug 2009 22:15:11 +0000 (15:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 23 Aug 2009 22:15:11 +0000 (15:15 -0700)
cook.sh

diff --git a/cook.sh b/cook.sh
index 563cac9c5936dbb689a42ffa83cc504b1aa08f31..c6775b56e11dea9c07f1f65f1c10c2497a2f669d 100755 (executable)
--- a/cook.sh
+++ b/cook.sh
@@ -107,6 +107,22 @@ add_desc () {
        description="$description $kind $others"
 }
 
+show_topic () {
+       old=$1 new=$2
+
+       sed -n -e '/^ ..*/p' "$old" >"$tmp.old.nc"
+       sed -n -e '/^ ..*/p' "$new" >"$tmp.new.nc"
+       if cmp "$tmp.old.nc" "$tmp.new.nc" >/dev/null
+       then
+               cat "$old"
+       else
+               cat "$new"
+               echo "<<"
+               cat "$old"
+               echo ">>"
+       fi
+}
+
 while read b
 do
        git rev-list --no-merges "master..$b"
@@ -230,7 +246,7 @@ perl -w -e '
                        $last_empty = 1;
                        next;
                }
-               if (/\[(.*)\]\s*$/) {
+               if (/^\[(.*)\]\s*$/) {
                        $section = $1;
                        $branch = undef;
                        next;
@@ -318,8 +334,6 @@ do
        else
                echo
        fi
-       cat "$tmp.output.$newserial"
-       echo "<<"
-       cat "$tmp.template.$oldserial"
-       echo ">>"
+
+       show_topic "$tmp.template.$oldserial" "$tmp.output.$newserial"
 done <"$tmp.template.toc"