6 # Set format of output as follows:
7 # abbrev-hash author-date(ISO8601-like) author-name author-email
8 FORMAT='%h %ai name=%an email=%ae'
9 # For portability/robustness, explicitly set n:o digits in commit hash (%h)
13 function show_help() {
17 Script to filter the git log for commits whose author's e-mail is
18 _not_ on @lyx.org. It's intended to be used by a CI job.
20 This script can be used to check that the LyX developers have
21 correctly configured their git to provide an e-mail address that's in
22 the @lyx.org domain. This is needed for proper functioning of the
23 e-mails being automatically sent to lyx-cvs@lyx.org.
26 <SCRIPT> { --help | -h | --list | -l | --compute-hash }
27 <SCRIPT> { --check-hash | -c } <EXPECTED-HASH>
33 # List contributions from non-@lyx.org-addresses since 2015-01-01
36 # Compute hash (SHA-512) of list of contributors
37 <SCRIPT> --compute-hash
39 # Check hash of list of contributors against expected hash.
40 # This scripts exist with a non-zero error code if hash does not match.
41 <SCRIPT> --check-hash \
42 1330d9fca5e385e9de8933cbf6d391222207b2f6af1cf7ca3175babfd4e5ab46b024ff2d98c7c8630b362be506da9376f9262a524755f9acf655d83dcce8a564
45 See e-mail thread on developers@lyx.org started by Scott 2017-07-30.
51 printf "An error occurred: %s\n" "$*"
55 function list_filtered_git_log() {
56 git log --since=$SINCE_DATE --format="$FORMAT" --abbrev=$HASH_ABBREV \
60 function compute_current_hash() {
61 FILTERED_LOG=$( list_filtered_git_log )
62 CURRENT_HASH=$( echo "$FILTERED_LOG" | shasum -a 512 | cut -d ' ' -f 1 )
77 printf "Current hash: %s\n" "$CURRENT_HASH"
83 [[ "$DESIRED_HASH" == "" ]] && fail "No expected hash value was provided."
85 if [[ "$CURRENT_HASH" == "$DESIRED_HASH" ]]; then
86 printf "Hash of filtered git log matches that of the provided expected hash\n:"
87 printf " Current: %s\n" "$CURRENT_HASH"
90 printf "Hash mismatch:\n"
91 printf " Desired: %s\n" "$DESIRED_HASH"
92 printf " Current: %s\n" "$CURRENT_HASH"
93 printf "Latest log:\n%s\n" "$FILTERED_LOG"
99 fail "Unrecognised command(s), give '-h' for help: '$*'"