Use tags in the email subject to pick up commit numbers.
authorStephen Haberman <stephen@exigencecorp.com>
Wed, 12 Nov 2008 04:43:50 +0000 (22:43 -0600)
committerStephen Haberman <stephen@exigencecorp.com>
Wed, 12 Nov 2008 04:43:50 +0000 (22:43 -0600)
server/post-receive-email
tests/t2200-2.txt [new file with mode: 0644]
tests/t2200-post-receive-email.sh
tests/t2201-4.txt
tests/t2201-5.txt

index 629fb6c..8d5d5c8 100755 (executable)
@@ -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
diff --git a/tests/t2200-2.txt b/tests/t2200-2.txt
new file mode 100644 (file)
index 0000000..2312907
--- /dev/null
@@ -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(-)
index 28733db..45d3e4f 100644 (file)
@@ -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
 
index 47bd8c3..cfec50e 100644 (file)
@@ -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
index 8fbafe6..f32e24a 100644 (file)
@@ -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