@@ -136,37 +136,50 @@ fi
url=$(git ls-remote --get-url "$url")
-git show -s --format='The following changes since commit %H:
+display_message() {
+ local format
+ local dash_line
+
+ dash_line="----------------------------------------------------------------"
+ format='The following changes since commit %H:
%s (%ci)
are available in the Git repository at:
-' $merge_base &&
-echo " $url $pretty_remote" &&
-git show -s --format='
-for you to fetch changes up to %H:
+'
+
+ git show -s --format="$format" $merge_base &&
+ echo " $url $pretty_remote" &&
+ format='for you to fetch changes up to %H:
%s (%ci)
+'
+ git show -s --format="
+$format
+$dash_line" $headrev &&
-----------------------------------------------------------------' $headrev &&
+ if test $(git cat-file -t "$head") = tag
+ then
+ git cat-file tag "$head" |
+ sed -n -e '1,/^$/d' -e '/^-----BEGIN PGP /q' -e p
+ echo
+ echo "$dash_line"
+ fi &&
-if test $(git cat-file -t "$head") = tag
-then
- git cat-file tag "$head" |
- sed -n -e '1,/^$/d' -e '/^-----BEGIN PGP /q' -e p
- echo
- echo "----------------------------------------------------------------"
-fi &&
+ if test -n "$branch_name"
+ then
+ echo "(from the branch description for $branch_name local branch)"
+ echo
+ git config "branch.$branch_name.description"
+ echo "$dash_line"
+ fi &&
-if test -n "$branch_name"
-then
- echo "(from the branch description for $branch_name local branch)"
- echo
- git config "branch.$branch_name.description"
- echo "----------------------------------------------------------------"
-fi &&
+ git shortlog ^$baserev $headrev &&
+ git diff -M --stat --summary $patch $merge_base..$headrev
+}
-git shortlog ^$baserev $headrev &&
-git diff -M --stat --summary $patch $merge_base..$headrev || status=1
+message=$(display_message) || status=1
+
+echo "$message"
exit $status
Move displaying PR message logic into display_message. While at it, use local variable $format and $dashline to shorten argument typing to git show. Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com> --- git-request-pull.sh | 57 ++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 22 deletions(-)