# 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 --reverse --stdin $newrev
+ git rev-parse --not --branches | grep -v $(git rev-parse $refname) | git rev-list --pretty --reverse --stdin $newrev
echo $LOGEND
echo ""
echo "Summary of changes:"
- git diff-tree --stat -p $newrev
+ oldest_new=$(git rev-parse --not --branches | grep -v $(git rev-parse $refname) | git rev-list --stdin $newrev | tail -n 1)
+ git diff-tree --stat -p $oldest_new^..$newrev
}
#
echo $test_name >a &&
git commit -a -m "$test_name" &&
git push &&
- old_commit_hash=$(git rev-parse HEAD^)
- new_commit_hash=$(git rev-parse HEAD)
- new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD)
- interpolate ../t2200-1.txt 1.txt old_commit_hash new_commit_hash new_commit_date
+ old_commit_hash=$(git rev-parse HEAD^) &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+ interpolate ../t2200-1.txt 1.txt old_commit_hash new_commit_hash new_commit_date &&
test_cmp 1.txt server/.git/refs.heads.master.out
'
--- /dev/null
+To: commits@list.com
+Subject: [SCM] UNNAMED PROJECT annotated tag, 1.0, created. 1.0
+X-Git-Refname: refs/tags/1.0
+X-Git-Reftype: annotated tag
+X-Git-Oldrev: 0000000000000000000000000000000000000000
+X-Git-Newrev: $tag_hash
+
+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 "UNNAMED PROJECT".
+
+The annotated tag, 1.0 has been created
+ at $tag_hash (tag)
+ tagging $new_commit_hash (commit)
+ tagged by C O Mitter
+ on $tag_date
+
+- Log -----------------------------------------------------------------
+1.0
+
+A U Thor (1):
+ setup
+
+-----------------------------------------------------------------------
+
+
+hooks/post-receive
+--
+UNNAMED PROJECT
--- /dev/null
+To: commits@list.com
+Subject: [SCM] UNNAMED PROJECT branch, master, updated. 1.0-2-g$new_commit_abbrev
+X-Git-Refname: refs/heads/master
+X-Git-Reftype: branch
+X-Git-Oldrev: $old_commit_hash
+X-Git-Newrev: $new_commit_hash
+
+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 "UNNAMED PROJECT".
+
+The branch, master has been updated
+ via $new_commit_hash (commit)
+ via $prior_commit_hash (commit)
+ from $old_commit_hash (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 $prior_commit_hash
+Author: A U Thor <author@example.com>
+Date: $prior_commit_date
+
+ commit on tag branch
+
+commit $new_commit_hash
+Author: A U Thor <author@example.com>
+Date: $new_commit_date
+
+ commit on tag branch 2
+
+-----------------------------------------------------------------------
+
+Summary of changes:
+ a | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/a b/a
+index 146f275..affecee 100644
+--- a/a
++++ b/a
+@@ -1 +1 @@
+-setup
++commit on tag branch 2
+
+
+hooks/post-receive
+--
+UNNAMED PROJECT
--- /dev/null
+To: commits@list.com
+Subject: [SCM] UNNAMED PROJECT annotated tag, 2.0, created. 2.0
+X-Git-Refname: refs/tags/2.0
+X-Git-Reftype: annotated tag
+X-Git-Oldrev: 0000000000000000000000000000000000000000
+X-Git-Newrev: $tag_hash
+
+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 "UNNAMED PROJECT".
+
+The annotated tag, 2.0 has been created
+ at $tag_hash (tag)
+ tagging $new_commit_hash (commit)
+ replaces 1.0
+ tagged by C O Mitter
+ on $tag_date
+
+- Log -----------------------------------------------------------------
+2.0
+
+A U Thor (2):
+ commit on tag branch
+ commit on tag branch 2
+
+-----------------------------------------------------------------------
+
+
+hooks/post-receive
+--
+UNNAMED PROJECT
--- /dev/null
+#!/bin/sh
+
+test_description='server post-receive email notification'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ git add a &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server &&
+ git config --add branch.master.remote origin &&
+ git config --add branch.master.merge refs/heads/master &&
+ GIT_DIR=./server/.git git config --add hooks.mailinglist commits@list.com &&
+ GIT_DIR=./server/.git git config --add hooks.debug true &&
+ GIT_DIR=.
+'
+
+install_server_hook 'post-receive-email' 'post-receive'
+
+test_expect_success 'create tag' '
+ git tag -a -m 1.0 1.0 &&
+ git push --tags &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ tag_hash=$(git rev-parse 1.0) &&
+ eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/1.0) &&
+
+ interpolate ../t2201-1.txt 1.txt new_commit_hash tag_hash tag_date &&
+ test_cmp 1.txt server/.git/refs.tags.1.0.out
+'
+
+test_expect_success 'commit on tag branch' '
+ old_commit_hash=$(git rev-parse HEAD) &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name" &&
+ prior_commit_hash=$(git rev-parse HEAD) &&
+ prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ echo "$test_name 2" >a &&
+ git commit -a -m "$test_name 2" &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ git push &&
+ new_commit_abbrev=$(git rev-list -n 1 --pretty=format:%h HEAD | grep -v commit) &&
+ interpolate ../t2201-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date new_commit_abbrev prior_commit_hash prior_commit_date &&
+ test_cmp 2.txt server/.git/refs.heads.master.out
+'
+
+test_expect_success 'retag branch' '
+ git tag -a -m 2.0 2.0 &&
+ git push --tags &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ tag_hash=$(git rev-parse 2.0) &&
+ eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
+
+ interpolate ../t2201-3.txt 3.txt new_commit_hash tag_hash tag_date &&
+ test_cmp 3.txt server/.git/refs.tags.2.0.out
+'
+
+test_done
+
--- /dev/null
+To: commits@list.com
+Subject: [SCM] UNNAMED PROJECT branch, topic, created. $new_commit_hash
+X-Git-Refname: refs/heads/topic
+X-Git-Reftype: branch
+X-Git-Oldrev: 0000000000000000000000000000000000000000
+X-Git-Newrev: $new_commit_hash
+
+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 "UNNAMED PROJECT".
+
+The branch, topic has been created
+ at $new_commit_hash (commit)
+
+- Log -----------------------------------------------------------------
+commit $prior_commit_hash
+Author: A U Thor <author@example.com>
+Date: $prior_commit_date
+
+ create branch on topic
+
+commit $new_commit_hash
+Author: A U Thor <author@example.com>
+Date: $new_commit_date
+
+ create branch on topic 2
+
+-----------------------------------------------------------------------
+
+Summary of changes:
+ a | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/a b/a
+index 146f275..8516a40 100644
+--- a/a
++++ b/a
+@@ -1 +1 @@
+-setup
++create branch 2
+
+
+hooks/post-receive
+--
+UNNAMED PROJECT
--- /dev/null
+To: commits@list.com
+Subject: [SCM] UNNAMED PROJECT branch, topic, deleted. $old_commit_hash
+X-Git-Refname: refs/heads/topic
+X-Git-Reftype: branch
+X-Git-Oldrev: $old_commit_hash
+X-Git-Newrev: 0000000000000000000000000000000000000000
+
+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 "UNNAMED PROJECT".
+
+The branch, topic has been deleted
+ was $old_commit_hash
+
+-----------------------------------------------------------------------
+$old_commit_hash create branch on topic 2
+-----------------------------------------------------------------------
+
+
+hooks/post-receive
+--
+UNNAMED PROJECT
--- /dev/null
+#!/bin/sh
+
+test_description='server post-receive email notification'
+
+. ./test-lib.sh
+
+test_expect_success 'setup' '
+ echo "setup" >a &&
+ git add a &&
+ git commit -m "setup" &&
+ git clone ./. server &&
+ rm -fr server/.git/hooks &&
+ git remote add origin ./server &&
+ git config --add branch.master.remote origin &&
+ git config --add branch.master.merge refs/heads/master &&
+ GIT_DIR=./server/.git git config --add hooks.mailinglist commits@list.com &&
+ GIT_DIR=./server/.git git config --add hooks.debug true &&
+ GIT_DIR=.
+'
+
+install_server_hook 'post-receive-email' 'post-receive'
+
+test_expect_success 'create branch' '
+ git checkout -b topic master &&
+ echo "$test_name" >a &&
+ git commit -a -m "$test_name on topic" &&
+ prior_commit_hash=$(git rev-parse HEAD) &&
+ prior_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ echo "$test_name 2" >a &&
+ git commit -a -m "$test_name on topic 2 " &&
+ new_commit_hash=$(git rev-parse HEAD) &&
+ new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+ git push origin topic &&
+
+ interpolate ../t2202-1.txt 1.txt new_commit_hash new_commit_date prior_commit_hash prior_commit_date &&
+ test_cmp 1.txt server/.git/refs.heads.topic.out
+'
+
+test_expect_success 'delete branch' '
+ old_commit_hash=$(git rev-parse HEAD) &&
+ git push origin :refs/heads/topic &&
+
+ interpolate ../t2202-2.txt 2.txt old_commit_hash &&
+ test_cmp 2.txt server/.git/refs.heads.topic.out
+'
+
+test_done
+