Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use tags in the email subject to pick up commit numbers.

  • Loading branch information...
commit 9c43e655de835ebf706f8845f56f7f45be0f2ad5 1 parent 5e1fb56
@stephenh authored
View
4 server/post-receive-email
@@ -63,7 +63,7 @@ generate_email()
set_change_type
set_rev_types
- set_describe
+ set_describe_tags
# The revision type tells us what type the commit is, combined with
# the location of the ref we can decide between
@@ -136,7 +136,7 @@ generate_email_header()
cat <<-EOF
From: $USER_EMAIL
To: $recipients
- Subject: ${emailprefix} $short_refname $refname_type ${change_type}d. $describe
+ Subject: ${emailprefix} $short_refname $refname_type ${change_type}d. $describe_tags
X-Git-Refname: $refname
X-Git-Reftype: $refname_type
X-Git-Oldrev: $oldrev
View
38 tests/t2200-2.txt
@@ -0,0 +1,38 @@
+From: author@example.com
+To: commits@list.com
+Subject: [cbas] master branch updated. r/1000
+X-Git-Refname: refs/heads/master
+X-Git-Reftype: branch
+X-Git-Oldrev: $old_commit_hash
+X-Git-Newrev: $new_commit_hash
+
+The branch, master has been updated
+ via $new_commit_abbrev simple commit with commitnumber
+ from $old_commit_abbrev simple commit
+
+Those revisions listed above that are new to this repository have
+not appeared on any other notification email; so we list those
+revisions in full, below.
+
+- Log -----------------------------------------------------------------
+
+commit $new_commit_hash
+Author: A U Thor <author@example.com>
+Date: $new_commit_date
+
+ simple commit with commitnumber
+
+$new_commit_hash
+diff --git a/a b/a
+index b38f23c..bd6aaf6 100644
+--- a/a
++++ b/a
+@@ -1 +1 @@
+-simple commit
++simple commit with commitnumber
+
+-----------------------------------------------------------------------
+
+Summary of changes:
+ a | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
View
17 tests/t2200-post-receive-email.sh
@@ -37,5 +37,22 @@ test_expect_success 'simple commit' '
test_cmp 1.txt server/.git/refs.heads.master.out
'
+test_expect_success 'simple commit with commitnumber' '
+ old_commit_hash=$(git rev-parse HEAD) &&
+ old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ echo $test_name >a &&
+ git commit -a -m "$test_name" &&
+ git tag r/1000 &&
+ git push --tags &&
+ git push &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+ new_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+ interpolate ../t2200-2.txt 2.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_date new_commit_abbrev &&
+ test_cmp 2.txt server/.git/refs.heads.master.out
+'
+
test_done
View
2  tests/t2201-4.txt
@@ -1,6 +1,6 @@
From: author@example.com
To: commits@list.com
-Subject: [cbas] 2.1 tag created. $new_commit_describe
+Subject: [cbas] 2.1 tag created. 2.1
X-Git-Refname: refs/tags/2.1
X-Git-Reftype: tag
X-Git-Oldrev: 0000000000000000000000000000000000000000
View
2  tests/t2201-5.txt
@@ -1,6 +1,6 @@
From: author@example.com
To: commits@list.com
-Subject: [cbas] 2.1 tag updated. $new_commit_describe
+Subject: [cbas] 2.1 tag updated. 2.1
X-Git-Refname: refs/tags/2.1
X-Git-Reftype: tag
X-Git-Oldrev: $old_commit_hash
Please sign in to comment.
Something went wrong with that request. Please try again.