| 1 | #!/bin/sh |
| 2 | # Announcement message skelton |
| 3 | # |
| 4 | : ${MASTER=master} |
| 5 | |
| 6 | tmpbase=/var/tmp/git-announce.$$ |
| 7 | trap 'rm -f $tmpbase.*' 0 |
| 8 | branch=${1?branch} |
| 9 | previous=${2?previous} |
| 10 | commit=${3-"$1"} |
| 11 | |
| 12 | relname=$(git describe "$commit") && |
| 13 | vername=$(expr "$relname" : 'v\(.*\)') || exit $? |
| 14 | |
| 15 | git rev-parse --verify "$previous" >/dev/null || exit $? |
| 16 | |
| 17 | case "$branch" in |
| 18 | maint) |
| 19 | kind="The latest maintenance release" ;; |
| 20 | mainto/* | maint-[0-9]*) |
| 21 | kind="A maintenance release" ;; |
| 22 | $MASTER) |
| 23 | kind="The latest feature release" ;; |
| 24 | esac |
| 25 | |
| 26 | case "$vername" in |
| 27 | *-rc[0-9]*) |
| 28 | rpmroot=testing |
| 29 | case "$vername" in |
| 30 | *-rc0) |
| 31 | kind="An early preview release" |
| 32 | ;; |
| 33 | *) |
| 34 | kind="A release candidate" |
| 35 | ;; |
| 36 | esac |
| 37 | for_testing=" for testing" |
| 38 | ;; |
| 39 | *) |
| 40 | for_testing= |
| 41 | rpmroot='RPMS/$arch' |
| 42 | ;; |
| 43 | esac |
| 44 | |
| 45 | vername=$(echo "$vername" | tr "-" ".") |
| 46 | |
| 47 | people () { |
| 48 | git shortlog -s --no-merges \ |
| 49 | --group=author \ |
| 50 | --group=trailer:co-authored-by \ |
| 51 | --group=trailer:reviewed-by \ |
| 52 | --group=trailer:mentored-by \ |
| 53 | --group=trailer:helped-by \ |
| 54 | --group=trailer:tested-by \ |
| 55 | --group=trailer:reported-by \ |
| 56 | "$@" | |
| 57 | sed -e '/: \(Claude\|Gemini\|ChatGPT\) /d' \ |
| 58 | -e 's/^[ 0-9]*[ ]//' -e 's/$/,/' | |
| 59 | sort -u |
| 60 | } |
| 61 | |
| 62 | people "$previous" >"$tmpbase.prev" |
| 63 | people "$previous..$commit" >"$tmpbase.this" |
| 64 | |
| 65 | comm -12 "$tmpbase.prev" "$tmpbase.this" >"$tmpbase.old" |
| 66 | comm -13 "$tmpbase.prev" "$tmpbase.this" >"$tmpbase.new" |
| 67 | |
| 68 | all=$(wc -l <"$tmpbase.this") |
| 69 | new=$(wc -l <"$tmpbase.new") |
| 70 | cnt=$(git rev-list --no-merges "$previous..$commit" | wc -l) |
| 71 | |
| 72 | cat <<EOF |
| 73 | To: git@vger.kernel.org |
| 74 | Cc: Linux Kernel <linux-kernel@vger.kernel.org>, |
| 75 | git-packagers@googlegroups.com |
| 76 | Bcc: lwn@lwn.net, gitster@pobox.com |
| 77 | Subject: [ANNOUNCE] Git $relname |
| 78 | |
| 79 | EOF |
| 80 | |
| 81 | ( |
| 82 | echo "$kind Git $relname is now available$for_testing at the usual places." |
| 83 | if test "$branch" = $MASTER |
| 84 | then |
| 85 | cat <<-EOF |
| 86 | It is comprised of $cnt non-merge commits since $previous, |
| 87 | contributed by $all people, $new of which are new faces [*]. |
| 88 | EOF |
| 89 | fi |
| 90 | ) | fmt -68 |
| 91 | |
| 92 | cat <<EOF |
| 93 | |
| 94 | The tarballs are found at: |
| 95 | |
| 96 | https://www.kernel.org/pub/software/scm/git/${for_testing:+testing/} |
| 97 | |
| 98 | EOF |
| 99 | |
| 100 | ( |
| 101 | cat <<-EOF |
| 102 | The following public repositories all have a copy of |
| 103 | the '$relname' tag and |
| 104 | EOF |
| 105 | case "$branch" in |
| 106 | maint-* | mainto/*) |
| 107 | echo "some of them have" |
| 108 | ;; |
| 109 | esac |
| 110 | echo "the '$branch' branch that the tag points at:" |
| 111 | ) | fmt -68 |
| 112 | |
| 113 | cat <<\EOF |
| 114 | |
| 115 | url = https://git.kernel.org/pub/scm/git/git |
| 116 | url = https://kernel.googlesource.com/pub/scm/git/git |
| 117 | url = git://repo.or.cz/alt-git.git |
| 118 | url = https://github.com/gitster/git |
| 119 | EOF |
| 120 | |
| 121 | fmt_people () { |
| 122 | # Yes, I don't perform well without 2 or more people. |
| 123 | # Sue me. The heading says "are as follows" anyway ;-). |
| 124 | sed -e '${ |
| 125 | s/^/and / |
| 126 | s/,$/./ |
| 127 | }' "$1" | |
| 128 | fmt -66 | |
| 129 | sed -e 's/^/ /' |
| 130 | |
| 131 | } |
| 132 | |
| 133 | if test "$branch" = $MASTER |
| 134 | then |
| 135 | cat <<-EOF |
| 136 | |
| 137 | New contributors whose contributions weren't in $previous are as follows. |
| 138 | Welcome to the Git development community! |
| 139 | |
| 140 | $(fmt_people "$tmpbase.new") |
| 141 | |
| 142 | Returning contributors who helped this release are as follows. |
| 143 | Thanks for your continued support. |
| 144 | |
| 145 | $(fmt_people "$tmpbase.old") |
| 146 | |
| 147 | [*] We are counting not just the authorship contribution but issue |
| 148 | reporting, mentoring, helping and reviewing that are recorded in |
| 149 | the commit trailers. |
| 150 | EOF |
| 151 | fi |
| 152 | |
| 153 | cat <<EOF |
| 154 | |
| 155 | ---------------------------------------------------------------- |
| 156 | |
| 157 | EOF |
| 158 | |
| 159 | case "$(git ls-tree ${branch} RelNotes)" in |
| 160 | 120000' '*) |
| 161 | RelNotes=$(git cat-file blob "${branch}:RelNotes") |
| 162 | ;; |
| 163 | *) |
| 164 | RelNotes=RelNotes |
| 165 | ;; |
| 166 | esac && |
| 167 | git cat-file blob "${branch}:$RelNotes" | |
| 168 | case "$relname" in |
| 169 | *-*) |
| 170 | sed -e 's/^Git .* Release Notes$/& (draft)/' \ |
| 171 | -e 's/^=============/&========/' |
| 172 | ;; |
| 173 | *) |
| 174 | cat |
| 175 | ;; |
| 176 | esac |
| 177 | |
| 178 | cat <<EOF |
| 179 | |
| 180 | ---------------------------------------------------------------- |
| 181 | |
| 182 | Changes since $previous are as follows: |
| 183 | |
| 184 | EOF |
| 185 | |
| 186 | git log --no-merges "$previous".."$branch" | |
| 187 | git shortlog |