From 431a8397e9337e570bc70759eeea326e0cb961f2 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 14 Aug 2016 20:52:45 -0700 Subject: [PATCH] mail.sh: restore "Merge: ..." line for merge commits When the URL was moved into the header of displayed new revisions, the "Merge: ..." line that's automatically added by --pretty=medium was inadvertently lost. Add it back to restore the original formatting. Signed-off-by: Kyle J. McKay --- taskd/mail.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/taskd/mail.sh b/taskd/mail.sh index bb8d7a6..1063b6b 100755 --- a/taskd/mail.sh +++ b/taskd/mail.sh @@ -755,8 +755,13 @@ generate_general_email() echol "" if [ "$newrev_type" = "commit" ]; then + if [ -n "$(git rev-list --no-walk --merges $newrev)" ]; then + pfmt12="$pfmt1$pfmt1m$pfmt2" + else + pfmt12="$pfmt1$pfmt2" + fi echol $LOGBEGIN - git diff-tree --no-color --date=$datefmt --root -s --always --encoding=UTF-8 --format="$pfmt1$projurlesc/$newrev16$pfmt2" $newrev + git diff-tree --no-color --date=$datefmt --root -s --always --encoding=UTF-8 --format="$pfmt12$projurlesc/$newrev16$pfmt3" $newrev echol $LOGEND else # What can we do here? The tag marks an object that is not @@ -834,19 +839,23 @@ show_new_revisions() if [ ${summaryonly:-false} = false ]; then if [ ${pcnt:-1} -gt 1 ]; then opts="-p --cc" + pfmt12="$pfmt1$pfmt1m$pfmt2" else opts="-p --stat=72 --summary" + pfmt12="$pfmt1$pfmt2" fi else if [ ${pcnt:-1} -gt 1 ]; then opts="-s" + pfmt12="$pfmt1$pfmt1m$pfmt2" else opts="--stat=72 --summary" + pfmt12="$pfmt1$pfmt2" fi fi scratch="${onerev#????????????????}" onerev16="${onerev%$scratch}" - git diff-tree --no-color --date=$datefmt $opts --always --encoding=UTF-8 --format="$pfmt1$projurlesc/$onerev16$pfmt2" --abbrev=$habbr -B -C --root $onerev + git diff-tree --no-color --date=$datefmt $opts --always --encoding=UTF-8 --format="$pfmt12$projurlesc/$onerev16$pfmt3" --abbrev=$habbr -B -C --root $onerev echo fi done @@ -900,9 +909,13 @@ habbr=12 # strftime formatting to use (empty is default rfc2822 format) sdatefmt= -# This is --pretty=medium in two parts with a URL: line added -pfmt1='format:commit %H%nAuthor: %an <%ae>%nDate: %ad%nURL: <' -pfmt2='>%n%n%w(0,4,4)%s%n%n%b' +# This is --pretty=medium in four parts with a URL: line added +# The pfmt1m value must be inserted after the pfmt1 value but only for merges +# The URL must be inserted between pfmt2 and pfmt3 +pfmt1='format:commit %H%n' +pfmt1m='Merge: %p%n' +pfmt2='Author: %an <%ae>%nDate: %ad%nURL: <' +pfmt3='>%n%n%w(0,4,4)%s%n%n%b' git_add_config core.abbrev=$habbr -- 2.11.4.GIT