diff options
Diffstat (limited to 'git-format-named-patches.sh')
-rwxr-xr-x | git-format-named-patches.sh | 5 |
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")" |