contributors.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2013-2017, 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.haxx.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. ###########################################################################
  23. #
  24. # This script shows all mentioned contributors from the given <hash>/<tag>
  25. # until HEAD and adds the contributors already mentioned in the existing
  26. # RELEASE-NOTES.
  27. #
  28. start=$1
  29. if test -z "$start"; then
  30. echo "Usage: $0 <since this tag/hash> [--releasenotes]"
  31. exit
  32. fi
  33. # filter out Author:, Commit: and *by: lines
  34. # cut off the email parts
  35. # split list of names at comma
  36. # split list of names at " and "
  37. # cut off spaces first and last on the line
  38. # filter alternatives through THANKS-filter
  39. # only count names with a space (ie more than one word)
  40. # sort all unique names
  41. # awk them into RELEASE-NOTES format
  42. (
  43. git log $start..HEAD | \
  44. egrep -ai '(^Author|^Commit|by):' | \
  45. cut -d: -f2- | \
  46. cut '-d(' -f1 | \
  47. cut '-d<' -f1 | \
  48. tr , '\012' | \
  49. sed 's/ and /\n/' | \
  50. sed -e 's/^ //' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
  51. grep -a "^ [^ \(]" RELEASE-NOTES| \
  52. sed 's/, */\n/g'| \
  53. sed 's/^ *//'
  54. )| \
  55. sed -f ./docs/THANKS-filter | \
  56. grep -a ' ' | \
  57. sort -fu | \
  58. awk '{
  59. num++;
  60. n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
  61. #print n;
  62. if(length(n) > 77) {
  63. printf(" %s\n", p);
  64. n=sprintf("%s,", $0);
  65. }
  66. p=n;
  67. }
  68. END {
  69. printf(" %s\n", p);
  70. printf(" (%d contributors)\n", num);
  71. }
  72. '