aboutsummaryrefslogtreecommitdiffstats
path: root/git-format-named-patches.sh
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-04-26 00:54:34 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-10-07 11:02:09 +0200
commit7aa80faf4b655a82af3860bf8689eff333fffbb5 (patch)
tree99754829424320917afac42dd23549599e5327ef /git-format-named-patches.sh
parent26107dbf358006369825f8793edc91ad8d23d90e (diff)
downloadgosc-7aa80faf4b655a82af3860bf8689eff333fffbb5.tar.gz
fix(git-format-named-patches): allow also only base reference
Diffstat (limited to 'git-format-named-patches.sh')
-rwxr-xr-xgit-format-named-patches.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/git-format-named-patches.sh b/git-format-named-patches.sh
index db34943..5ec9c69 100755
--- a/git-format-named-patches.sh
+++ b/git-format-named-patches.sh
@@ -34,6 +34,8 @@ shift $((OPTIND-1))
if [ "$#" -lt 1 ] ; then
INTEREST="HEAD~..HEAD"
+elif [[ ! "$1" =~ '..' ]] ; then
+ INTEREST="$1..HEAD"
else
INTEREST="$1"
fi
@@ -44,7 +46,8 @@ IDSstr="$(git log --format="%H" "$INTEREST" 2>/dev/null | tac)"
mapfile -t IDS <<< "$IDSstr"
for id in "${IDS[@]}" ; do
PATCH="$(git format-patch -1 --stdout "${id}")"
- FN="$(echo "$PATCH" | git interpret-trailers --parse | awk '/^Patch: / {print $2}')"
+ TRAILERS="$(echo "$PATCH" | git interpret-trailers --parse)"
+ FN="$(echo "$TRAILERS" | awk '/^Patch: / {print $2}')"
[ -z "$FN" ] && fail "Patch filename not defined"
if [ -n "$SUBDIR" ] ; then
FFN="$(readlink -f "$SUBDIR"/"$FN")"