From 4d7b647050f059ba30e9860854898e9a45134d35 Mon Sep 17 00:00:00 2001 From: Henry Gabryjelski <740168+henrygab@users.noreply.github.com> Date: Sat, 13 Jun 2026 17:45:46 -0700 Subject: [PATCH] Resolve github codepilot recommendations * Shell script NOT updated to use an atomic rename after writing to temp file. Don't commit if it's not right. * Shell script `set -e` is now `set -euo pipefail` * Shell script uses short-form options for `sort` * Three typos fixed in markdown * .gitignore updated to ignore codeql trash --- .gitignore | 5 +++++ filter_git_blame.md | 6 +++--- filter_git_blame.sh | 5 +++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 9c42779fa..655186cd5 100644 --- a/.gitignore +++ b/.gitignore @@ -114,3 +114,8 @@ fpga_version_info.c # docs !doc/*.json + +# codeql +codeql/ +_codeql_detected_source_root + diff --git a/filter_git_blame.md b/filter_git_blame.md index eb73471d6..171148a84 100644 --- a/filter_git_blame.md +++ b/filter_git_blame.md @@ -32,7 +32,7 @@ it was matching against ANY of the (potentially many) lines in the commit messag ## Fixup how to get the commits of interest.... -My goal was to match only when the **entire** commit message begans with the pattern. +My goal was to match only when the **entire** commit message begins with the pattern. For some patterns, I wanted to match against the entire multi-line message. This seemed like something designed for `awk`, and `git log --format=...` allows @@ -100,7 +100,7 @@ character, but continues to split the fields with `[ \t\n]+` (default field sepa Maybe change each record to be of the form: -`([0-9a-fA-F]{39})\x00([^\x00]*)\x00`, which means that +`([0-9a-fA-F]{40})\x00([^\x00]*)\x00`, which means that `$1` == commit hash, and `$2` == message body. @@ -324,7 +324,7 @@ clear; git log --format='%H%n%B%x00' | awk -v RS='\0' ' do_print = 0 any_match = 0 - # message ... remove trailing whitepace and blank lines + # message ... remove trailing whitespace and blank lines msg = matches[2] sub(/( *(\r?\n))+$/, "", msg) diff --git a/filter_git_blame.sh b/filter_git_blame.sh index 2a558970d..5101f763e 100755 --- a/filter_git_blame.sh +++ b/filter_git_blame.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -e +set -euo pipefail git log --format='%H%n%B%x00' | awk -v RS='\0' ' BEGIN { @@ -29,4 +29,5 @@ git log --format='%H%n%B%x00' | awk -v RS='\0' ' print matches[1] } } -' | sort --unique --ignore-case > .git-blame-ignore-revs +' | sort -u -f > .git-blame-ignore-revs +