[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Savannah-hackers-public] Re: Git commit notification hook
From: |
Jim Meyering |
Subject: |
[Savannah-hackers-public] Re: Git commit notification hook |
Date: |
Sat, 23 Feb 2008 08:13:34 +0100 |
Sylvain Beucler <address@hidden> wrote:
> I'm trying to setup commit notification hooks for a couple projects at
> Savannah.
>
> I notice that coreutils.git uses a different version of the commit
> hook than what's in git.git/contrib/hooks. In particular there's
> support for commit diffs and gitweb URL.
Yep. I'll change the coreutils one to be like the others.
The only reason I haven't bothered so far is because I'm
the only recipient.
> Is this your work/patch, or is it a different version?
It's mine.
I would have submitted it upstream, but when pushing
multiple commits or tags, it's not useful:
>From a7e31363a04a6a526086de888d7baaf71e2a45ba Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 27 Sep 2007 11:38:50 +0200
Subject: [PATCH] Include commit-url unconditionally, even though sometimes
(tag-push) it's bogus.
Add an option to include diffs in email.
Signed-off-by: Jim Meyering <address@hidden>
---
contrib/hooks/post-receive-email | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 77c88eb..a9b313f 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -184,6 +184,11 @@ generate_email_header()
{
# --- Email (all stdout will be the email)
# Generate header
+ commit_url_format_string=$(git repo-config hooks.commiturl)
+ case $commit_url_format_string in
+ '') commit_url= ;;
+ *) commit_url=$(printf "\n\n$commit_url_format_string" $newrev) ;;
+ esac
cat <<-EOF
To: $recipients
Subject: ${emailprefix}$projectdesc $refname_type, $short_refname,
${change_type}d. $describe
@@ -194,7 +199,7 @@ generate_email_header()
This is an automated email from the git hooks/post-receive script. It
was
generated because a ref change was pushed to the repository containing
- the project "$projectdesc".
+ the project "$projectdesc".$commit_url
The $refname_type, $short_refname has been ${change_type}d
EOF
@@ -410,7 +415,12 @@ generate_update_branch_email()
# non-fast forward updates.
echo ""
echo "Summary of changes:"
- git diff-tree --stat --summary --find-copies-harder $oldrev..$newrev
+ show_diff=$(git repo-config hooks.maildiffs)
+ case $show_diff in
+ y|yes|1) p=-p;;
+ *) p=;;
+ esac
+ git diff-tree $p --stat --summary --find-copies-harder $oldrev..$newrev
}
#
--
1.5.4.2.185.gf5f8