xref: /curl/scripts/contributors.sh (revision fa69b41c)
1#!/bin/sh
2#***************************************************************************
3#                                  _   _ ____  _
4#  Project                     ___| | | |  _ \| |
5#                             / __| | | | |_) | |
6#                            | (__| |_| |  _ <| |___
7#                             \___|\___/|_| \_\_____|
8#
9# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22# SPDX-License-Identifier: curl
23#
24###########################################################################
25
26#
27# This script shows all mentioned contributors from the given <hash>/<tag>
28# until HEAD and adds the contributors already mentioned in the existing
29# RELEASE-NOTES.
30#
31
32set -eu
33
34start="${1:-}"
35
36if test "$start" = "-h"; then
37  echo "Usage: $0 <since this tag/hash> [--releasenotes]"
38  exit
39fi
40if test -z "$start"; then
41  start=$(git tag --sort=taggerdate | grep "^curl-" | tail -1)
42  echo "Since $start:"
43fi
44
45# We also include curl-www if possible. Override by setting CURLWWW
46CURLWWW="${CURLWWW:-../curl-www}"
47
48# filter out Author:, Commit: and *by: lines
49# cut off the email parts
50# split list of names at comma
51# split list of names at " and "
52# cut off spaces first and last on the line
53# filter alternatives through THANKS-filter
54# only count names with a space (ie more than one word)
55# sort all unique names
56# awk them into RELEASE-NOTES format
57
58{
59  {
60    git log --pretty=full --use-mailmap "$start..HEAD"
61    if [ -d "$CURLWWW" ]; then
62      git -C "$CURLWWW" log --pretty=full --use-mailmap "$start..HEAD"
63    fi
64  } | \
65  grep -Eai '(^Author|^Commit|by):' | \
66  cut -d: -f2- | \
67  cut '-d(' -f1 | \
68  cut '-d<' -f1 | \
69  tr , '\012' | \
70  sed 's/ at github/ on github/' | \
71  sed 's/ and /\n/' | \
72  sed -e 's/^ *//' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
73
74  grep -a "^  [^ \(]" RELEASE-NOTES| \
75  sed 's/, */\n/g'| \
76  sed 's/^ *//'
77} | \
78sed -f ./docs/THANKS-filter | \
79sort -fu | \
80awk '
81{
82 if(length($0)) {
83   num++;
84   n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
85   #print n;
86   if(length(n) > 77) {
87     printf("  %s\n", p);
88     n=sprintf("%s,", $0);
89   }
90   p=n;
91 }
92}
93
94END {
95  pp=substr(p,1,length(p)-1);
96  printf("  %s\n", pp);
97  printf("  (%d contributors)\n", num);
98}
99'
100