contributors.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. # This script shows all mentioned contributors from the given <hash>/<tag>
  27. # until HEAD and adds the contributors already mentioned in the existing
  28. # RELEASE-NOTES.
  29. #
  30. set -eu
  31. start="${1:-}"
  32. if test "$start" = "-h"; then
  33. echo "Usage: $0 <since this tag/hash> [--releasenotes]"
  34. exit
  35. fi
  36. if test -z "$start"; then
  37. start=$(git tag --sort=taggerdate | grep "^curl-" | tail -1)
  38. echo "Since $start:"
  39. fi
  40. # We also include curl-www if possible. Override by setting CURLWWW
  41. CURLWWW="${CURLWWW:-../curl-www}"
  42. # filter out Author:, Commit: and *by: lines
  43. # cut off the email parts
  44. # split list of names at comma
  45. # split list of names at " and "
  46. # cut off spaces first and last on the line
  47. # filter alternatives through THANKS-filter
  48. # only count names with a space (ie more than one word)
  49. # sort all unique names
  50. # awk them into RELEASE-NOTES format
  51. {
  52. {
  53. git log --pretty=full --use-mailmap "$start..HEAD"
  54. if [ -d "$CURLWWW" ]; then
  55. git -C "$CURLWWW" log --pretty=full --use-mailmap "$start..HEAD"
  56. fi
  57. } | \
  58. grep -Eai '(^Author|^Commit|by):' | \
  59. cut -d: -f2- | \
  60. cut '-d(' -f1 | \
  61. cut '-d<' -f1 | \
  62. tr , '\012' | \
  63. sed 's/ at github/ on github/' | \
  64. sed 's/ and /\n/' | \
  65. sed -e 's/^ *//' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
  66. grep -a "^ [^ \(]" RELEASE-NOTES| \
  67. sed 's/, */\n/g'| \
  68. sed 's/^ *//'
  69. } | \
  70. sed -f ./docs/THANKS-filter | \
  71. sort -fu | \
  72. awk '
  73. {
  74. if(length($0)) {
  75. num++;
  76. n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
  77. #print n;
  78. if(length(n) > 77) {
  79. printf(" %s\n", p);
  80. n=sprintf("%s,", $0);
  81. }
  82. p=n;
  83. }
  84. }
  85. END {
  86. pp=substr(p,1,length(p)-1);
  87. printf(" %s\n", pp);
  88. printf(" (%d contributors)\n", num);
  89. }
  90. '