find_authors 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/usr/bin/env sh
  2. #usernames that do not match attributed name
  3. declare -a usernames=("Jean-Claude_Computing" "Rafael" "linkslice" "juliopedreira" "nagios" "arvanus" "nafets" "abrist" "awiddersheim" "Holger_Weiß" "palli" "dermoth" "M._Remy" "tonvoon" "nagiosplugins" "Thomas_Guyot-Sionnest_thomas@aei.ca" "M._Sean_Finney" "(no_author)" "LAURENT_LICOUR")
  4. authors=()
  5. count=0
  6. THANKS="THANKS.in"
  7. AUTHORS="AUTHORS"
  8. # 1 - array to check against
  9. # 2 - name to search for
  10. # return 0 - no match, 1 - match
  11. check_names () {
  12. declare -a int_arr=("${!1}")
  13. for name in ${int_arr[@]}; do
  14. if [[ "${2}" == "${name}" ]]; then
  15. return 1
  16. fi
  17. done
  18. return 0
  19. }
  20. # compare lists
  21. for name in $(git log | grep "Author:" | sed 's/Author: //g' | sed 's/ <.*>//g' | sed 's/ /_/g'); do
  22. # skip to next name if found
  23. if echo "${name}" | sed 's/_/ /g' | grep -q -f - "${THANKS}" || \
  24. echo "${name}" | sed 's/_/ /g' | grep -q -f - "${AUTHORS}"; then
  25. continue;
  26. # name was not found, keep only one instance of it
  27. elif $(check_names authors[@] "${name}") && $(check_names usernames[@] "${name}"); then
  28. authors=("${authors[@]}" "${name}")
  29. fi
  30. done
  31. echo "Authors not found:"
  32. for name in ${authors[@]}; do
  33. echo "${name}" | sed 's/_/ /g'
  34. done