public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [Note] Patches not sent to list
@ 2023-06-20 18:53 Simon Farre
  0 siblings, 0 replies; only message in thread
From: Simon Farre @ 2023-06-20 18:53 UTC (permalink / raw)
  To: gdb-patches

Two patches were pushed to the repo that did not get sent to the list. 
These only included formatting changes from black.

d32d7e918de - Fixes 28ab59607ef40b9571c0702ffba8f6aa6fb1b033

and

ce65796b17d - Fixes f1a614dc8f015743e9fe7fe5f3f019303f8db718

Sorry about that, won't happen again.

For posterity, here's a pre-commit hook that will save future 
contributors from these kinds of problems;

#
# Pre-commit hook file
#

binutils_root=`git rev-parse --show-toplevel`
# Verify that changed python files are properly formatted
files=`exec git diff --cached --name-only`

failed_check=()
has_failure=0
while IFS= read -r file_path; do

     file_ext="${file_path##*.}"

     # We only want to run black on python files
     if [[ "$file_ext" == "py" ]]; then
         black --check "$binutils_root/$file_path" >/dev/null 2>&1
         exit_code=$?
         if [[ "$exit_code" -ne 0 ]]; then
           failed_check+=("$file_path")
           has_failure=1
         fi
     fi
done <<< "$files"

if [[ "$has_failure" -eq 1 ]]; then
   echo "You need to format these files using black"
   for file in "${failed_check[@]}"; do
     echo "  $file"
   done
   exit 1
fi

exit 0

Regards,
Simon


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-20 18:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 18:53 [Note] Patches not sent to list Simon Farre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).