Przeglądaj źródła

tools/find_authors - Script to find git authors

Simple script to check git against authors and thanks files. Needs a few specific cases, as names are not matching attribution.
Spenser Reinhardt 11 lat temu
rodzic
commit
758dcf2077
1 zmienionych plików z 38 dodań i 0 usunięć
  1. 38 0
      tools/find_authors

+ 38 - 0
tools/find_authors

@@ -0,0 +1,38 @@
+#!/usr/bin/env sh
+
+#usernames that do not match attributed name
+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")
+authors=()
+count=0
+THANKS="THANKS.in"
+AUTHORS="AUTHORS"
+
+# 1 - array to check against
+# 2 - name to search for
+# return 0 - no match, 1 - match
+check_names () {
+	declare -a int_arr=("${!1}")
+	for name in ${int_arr[@]}; do
+		if [[ "${2}" == "${name}" ]]; then
+			return 1
+		fi
+	done
+	return 0
+}
+
+# compare lists
+for name in $(git log | grep "Author:" | sed 's/Author: //g' | sed 's/ <.*>//g' | sed 's/ /_/g'); do
+	# skip to next name if found
+	if echo "${name}" | sed 's/_/ /g' | grep -q -f - "${THANKS}" || \
+	echo "${name}" | sed 's/_/ /g' | grep -q -f - "${AUTHORS}"; then
+		continue;
+	# name was not found, keep only one instance of it
+	elif $(check_names authors[@] "${name}") && $(check_names usernames[@] "${name}"); then
+			authors=("${authors[@]}" "${name}")
+	fi
+done
+
+echo "Authors not found in thanks.in:"
+for name in ${authors[@]}; do
+	echo "${name}" | sed 's/_/ /g'
+done