Created
September 30, 2025 07:04
-
-
Save rainbow23/3963094cdce51fbfbcfe89657ffa09dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| if [ $# -lt 1 ] || [ $# -gt 2 ]; then | |
| echo "Usage: $0 <block-log> [output-prefix]" >&2 | |
| exit 1 | |
| fi | |
| BLOCKLOG="$1" | |
| PREFIX="${2:-pana}" # デフォルトは "pana" | |
| if [ ! -f "$BLOCKLOG" ]; then | |
| echo "Error: file not found: $BLOCKLOG" >&2 | |
| exit 1 | |
| fi | |
| i=1 | |
| awk ' | |
| /^PANA/ { if (match($0, /[0-9a-f]{7,40}/, m)) first=m[0] } | |
| /^NO_PANA/ { if (match($0, /[0-9a-f]{7,40}/, m)) { last=m[0]; print first, last } } | |
| ' "$BLOCKLOG" \ | |
| | while read -r first last; do | |
| outfile="${PREFIX}${i}.patch" | |
| echo "Generating patch for $first...$last -> $outfile" | |
| git format-patch "${first}...${last}" -1 --stdout > "$outfile" | |
| i=$((i+1)) | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment