X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=git%2Fpost-receive-email;h=c565634e6e2f257a1ae00fc2f605a311db5bd971;hb=ab5427d31da2bd95805cccc8e47b8f43d3dd606d;hp=60cce2c91cf51a0b61bdd542c1501fc1b7151830;hpb=133b93494ac4f0fd521bae070e01ab599852361a;p=sbcl.git diff --git a/git/post-receive-email b/git/post-receive-email index 60cce2c..c565634 100755 --- a/git/post-receive-email +++ b/git/post-receive-email @@ -346,17 +346,11 @@ generate_update_branch_email() # have already had notification emails and is present to show the # full detail of the change from rolling back the old revision to # the base revision and then forward to the new revision - # - # For SBCL we skip this for branch updates, since we're getting - # one email per commit. - if [ "branch" != "$refname_type" ] || [ "update" != "$change_type" ] - then - for rev in $(git rev-list $oldrev..$newrev) - do - revtype=$(git cat-file -t "$rev") - echo " via $rev ($revtype)" - done - fi + for rev in $(git rev-list $oldrev..$newrev) + do + revtype=$(git cat-file -t "$rev") + echo " via $rev ($revtype)" + done if [ "$fast_forward" ]; then echo " from $oldrev ($oldrev_type)" @@ -411,8 +405,8 @@ generate_update_branch_email() # echo "Those revisions listed above that are new to this repository have" # echo "not appeared on any other notification email; so we list those" # echo "revisions in full, below." + # echo "" - echo "" echo $LOGBEGIN show_new_revisions @@ -710,25 +704,46 @@ if [ -n "$1" -a -n "$2" -a -n "$3" ]; then else while read oldrev newrev refname do - echo "Sending email for $refname: $oldrev -> $newrev" + echo "Sending mail for $refname: $oldrev -> $newrev" # SBCL KLUDGE: the default script sends one email per # push. We want one per commit. As long as we're # in fast-forward-only world, this should do the # right thing. - if (expr "$oldrev" : '0*$' >/dev/null || - expr "$newrev" : '0*$' >/dev/null || - ! expr "$refname" : "refs/heads/" > /dev/null) + if (expr "$oldrev" : '0*$' >/dev/null || # create + expr "$newrev" : '0*$' >/dev/null || # delete + ! expr "$refname" : "refs/heads/" > /dev/null) # not a branch then # Just one email. + echo "Not a branch update: all changes in one email." generate_email $oldrev $newrev $refname | send_mail else - # Branch update, one mail per commit. - lastrev=$oldrev - for step in $(git rev-list --reverse $oldrev..$newrev) - do - generate_email $lastrev $step $refname | send_mail - lastrev=$step - done + # Get all revisions from old to new. + revlist=$(git rev-list --reverse $oldrev..$newrev) + no_merges=true + # Check for merges. + for rev in $revlist + do + if ($no_merges && git rev-parse --verify --quiet "$rev"^2 > /dev/null) + then + echo "Merge detected: $rev. Sending all commits in a single email." + no_merges=false + fi + done + if $no_merges + then + # Simple branch update, one mail per commit. + echo "Sending one email per commit." + lastrev=$oldrev + for step in $revlist + do + echo "Sending: $(git log -n1 --oneline $step)" + generate_email $lastrev $step $refname | send_mail + lastrev=$step + done + else + # There's a merge -- just one email. + generate_email $oldrev $newrev $refname | send_mail + fi fi done fi