From 5997724be734ad9579672f886c987bb104ffa749 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Thu, 9 Nov 2023 14:31:50 -0500 Subject: [PATCH] hvsp: allow to specify end commit as a label If end commit starts with "end", then assume end commit is the commit just before that end commit label. --- scripts/kernel-send-patches.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/kernel-send-patches.sh b/scripts/kernel-send-patches.sh index b928b32..c41886b 100755 --- a/scripts/kernel-send-patches.sh +++ b/scripts/kernel-send-patches.sh @@ -184,6 +184,16 @@ find_commit_by_log() echo $(git log --oneline HEAD~100..HEAD | grep "${1}" | awk {'print $1'}) } +# Find SHA1 of preceding commit: +# First arg: commit message +find_preceding_commit_by_log() +{ + local sha1_end + + sha1_end="$(find_commit_by_log "${1}")" + echo $(git log --oneline ${sha1_end}~2..${sha1_end}~1 | awk {'print $1'}) +} + # Remove "Name" if present in email address. Needed because of a bug in # get_maintainer.pl even if we specify the "--non" option. # Arg #1: "Name " or "email" @@ -245,6 +255,11 @@ if [ x"${COMMIT_END_SHA1}" = x"" ]; then exit 1 fi +if echo "${commit_end}" | grep -q "^end"; then + # Take commit just before end commit: + COMMIT_END_SHA1=$(find_preceding_commit_by_log "${commit_end}") +fi + rm -rf ${srcdir}/*.patch # If the cover letter is not between start and end commits, save a copy: -- 2.20.1