From 69675305c0582606296c412d3e50681e77cf5675 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 7 Oct 2016 16:32:39 -0700 Subject: [PATCH] mail.sh: suppress new branch diffstat for root+merge Tweak the logic slightly so that if a new branch notification would show the new branch all the way down to its root commit, that it does not mistakenly show the diff stat when one of the commits on the way to the root was a merge that merged in commits previously shown. Basically this was just an off-by-1 error when showing a new branch whose root commit had never been seen before. Also fix the comments about what LAST_SHOWN_NBOUNDARY really is. Signed-off-by: Kyle J. McKay --- taskd/mail.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/taskd/mail.sh b/taskd/mail.sh index eb485c5..4b8dae6 100755 --- a/taskd/mail.sh +++ b/taskd/mail.sh @@ -390,11 +390,12 @@ generate_create_branch_email() # a diffstat from the last shown revisions's parent (or the empty tree # if the last revision shown is a root revision) to the new revision # provided the last shown revision is not a merge commit and there - # was at most a single boundary commit encountered by show_new_revisions. + # were no more boundary commits encountered by show_new_revisions than + # the last shown revision has parents. # This is to show the truth of what happened in this change. if [ -n "$LAST_SHOWN_REVISION" ] && [ -n "$LAST_SHOWN_NPARENTS" ] && [ -n "$LAST_SHOWN_NBOUNDARY" ] && \ - [ "$LAST_SHOWN_NPARENTS" -le 1 ] && [ "$LAST_SHOWN_NBOUNDARY" -le 1 ]; then + [ "$LAST_SHOWN_NPARENTS" -le 1 ] && [ "$LAST_SHOWN_NBOUNDARY" -le "$LAST_SHOWN_NPARENTS" ]; then if [ "$LAST_SHOWN_NPARENTS" -eq 0 ]; then # Note that since Git 1.5.5 the empty tree object is ALWAYS available # whether or not it's actually present in the repository. @@ -810,7 +811,10 @@ generate_delete_general_email() # # On return LAST_SHOWN_REVISION will be set to non-empty if any revisions shown # and LAST_SHOWN_NPARENTS will be the number of parents it has (possibly 0) -# and LAST_SHOWN_NBOUNDARY will be the number of shown leaves (possibly 0) +# and LAST_SHOWN_NBOUNDARY will be the total number of boundary commits seen (possibly 0) +# So if $LAST_SHOWN_NBOUNDARY is greater than $LAST_SHOWN_NPARENTS then the +# portion of the graph shown by show_new_revisions (excluding $LAST_SHOWN_REVISION) +# includes at least one merge commit that had at least one parent excluded. # show_new_revisions() { -- 2.11.4.GIT