mirror of
https://github.com/git/git
synced 2024-09-13 21:34:42 +00:00
contrib/hooks/post-receive-email: Put rev display in separate function
The display of a revision in an email-appropriate format is done in two places with similar code. In preparation for making that display more complex, move it into a separate function that handles both cases. Signed-off-by: Pete Harlan <pgit@pcharlan.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b1a46b70b3
commit
4471649f44
|
@ -224,13 +224,7 @@ generate_create_branch_email()
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo $LOGBEGIN
|
echo $LOGBEGIN
|
||||||
# This shows all log entries that are not already covered by
|
show_new_revisions
|
||||||
# another ref - i.e. commits that are now accessible from this
|
|
||||||
# ref that were previously not accessible
|
|
||||||
# (see generate_update_branch_email for the explanation of this
|
|
||||||
# command)
|
|
||||||
git rev-parse --not --branches | grep -v $(git rev-parse $refname) |
|
|
||||||
git rev-list --pretty --stdin $newrev
|
|
||||||
echo $LOGEND
|
echo $LOGEND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,8 +384,7 @@ generate_update_branch_email()
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo $LOGBEGIN
|
echo $LOGBEGIN
|
||||||
git rev-parse --not --branches | grep -v $(git rev-parse $refname) |
|
show_new_revisions
|
||||||
git rev-list --pretty --stdin $oldrev..$newrev
|
|
||||||
|
|
||||||
# XXX: Need a way of detecting whether git rev-list actually
|
# XXX: Need a way of detecting whether git rev-list actually
|
||||||
# outputted anything, so that we can issue a "no new
|
# outputted anything, so that we can issue a "no new
|
||||||
|
@ -591,6 +584,36 @@ generate_delete_general_email()
|
||||||
echo $LOGEND
|
echo $LOGEND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# --------------- Miscellaneous utilities
|
||||||
|
|
||||||
|
#
|
||||||
|
# Show new revisions as the user would like to see them in the email.
|
||||||
|
#
|
||||||
|
show_new_revisions()
|
||||||
|
{
|
||||||
|
# This shows all log entries that are not already covered by
|
||||||
|
# another ref - i.e. commits that are now accessible from this
|
||||||
|
# ref that were previously not accessible
|
||||||
|
# (see generate_update_branch_email for the explanation of this
|
||||||
|
# command)
|
||||||
|
|
||||||
|
# Revision range passed to rev-list differs for new vs. updated
|
||||||
|
# branches.
|
||||||
|
if [ "$change_type" = create ]
|
||||||
|
then
|
||||||
|
# Show all revisions exclusive to this (new) branch.
|
||||||
|
revspec=$newrev
|
||||||
|
else
|
||||||
|
# Branch update; show revisions not part of $oldrev.
|
||||||
|
revspec=$oldrev..$newrev
|
||||||
|
fi
|
||||||
|
|
||||||
|
git rev-parse --not --branches | grep -v $(git rev-parse $refname) |
|
||||||
|
git rev-list --pretty --stdin $revspec
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
send_mail()
|
send_mail()
|
||||||
{
|
{
|
||||||
if [ -n "$envelopesender" ]; then
|
if [ -n "$envelopesender" ]; then
|
||||||
|
|
Loading…
Reference in a new issue