]> git.droids-corp.org - git-central.git/commitdiff
Test the conflict diff email.
authorStephen Haberman <stephen@exigencecorp.com>
Sun, 28 Sep 2008 06:49:48 +0000 (01:49 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Sun, 28 Sep 2008 06:49:48 +0000 (01:49 -0500)
tests/t2204-1.txt [new file with mode: 0644]
tests/t2204-server-post-receive-email-conflicts.sh [new file with mode: 0644]

diff --git a/tests/t2204-1.txt b/tests/t2204-1.txt
new file mode 100644 (file)
index 0000000..4b7d92b
--- /dev/null
@@ -0,0 +1,45 @@
+From: author@payflex.com\r
+To: commits@list.com\r
+Subject: [cbas] topic1 branch updated. $new_commit_hash\r
+X-Git-Refname: refs/heads/topic1\r
+X-Git-Reftype: branch\r
+X-Git-Oldrev: $old_commit_hash\r
+X-Git-Newrev: $new_commit_hash\r
+\r
+The branch, topic1 has been updated\r
+       via $new_commit_abbrev resolved lines for merging stable into topic1\r
+      from $old_commit_abbrev lines changed on topic1\r
+\r
+Those revisions listed above that are new to this repository have\r
+not appeared on any other notification email; so we list those\r
+revisions in full, below.\r
+\r
+- Log -----------------------------------------------------------------\r
+\r
+commit $new_commit_hash\r
+Merge: $old_commit_hash $stable_hash\r
+Author: A U Thor <author@example.com>\r
+Date:   $new_commit_date\r
+\r
+    resolved lines for merging stable into topic1\r
+\r
+$new_commit_hash\r
+diff --cc a\r
+index d288e69,a9ccdfe..3f45f93\r
+--- a/a\r
++++ b/a\r
+@@@ -1,3 -1,3 +1,3 @@@\r
+- line1.topic1\r
+- line2.topic1\r
+- line3.topic1\r
+ -line1.stable\r
+++line1.topic\r
++ line2.stable\r
+ -line3.stable\r
+++line3.resolved\r
+\r
+-----------------------------------------------------------------------\r
+\r
+Summary of changes:\r
+ a |    6 +++---\r
+ 1 files changed, 3 insertions(+), 3 deletions(-)\r
diff --git a/tests/t2204-server-post-receive-email-conflicts.sh b/tests/t2204-server-post-receive-email-conflicts.sh
new file mode 100644 (file)
index 0000000..45b7cb9
--- /dev/null
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+test_description='server post-receive email notification and how it behaves in our stable-based envrionment'
+
+. ./test-lib.sh
+
+export USER=author
+
+test_expect_success 'setup' '
+       echo "setup" >a &&
+       echo "setup" >b &&
+       echo "setup" >c &&
+       git add a b c &&
+       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.post-receive-email.mailinglist commits@list.com &&
+       GIT_DIR=./server/.git git config --add hooks.post-receive-email.debug true &&
+       GIT_DIR=. &&
+       echo cbas >./server/.git/description &&
+
+       git checkout -b stable &&
+       git push origin stable
+'
+
+install_post_receive_hook 'post-receive-email'
+
+test_expect_success 'conflict diff' '
+       git checkout stable &&
+       echo "line1" >a &&
+       echo "line2" >>a &&
+       echo "line3" >>a &&
+       git commit -a -m "lines" &&
+       git push origin stable &&
+
+       git checkout -b topic1 stable &&
+       echo "line1.topic1" >a &&
+       echo "line2.topic1" >>a &&
+       echo "line3.topic1" >>a &&
+       git commit -a -m "lines changed on topic1" &&
+       git push origin topic1 &&
+
+       old_commit_hash=$(git rev-parse HEAD) &&
+       old_commit_abbrev=$(git rev-parse --short HEAD) &&
+
+       # Move stable
+       git checkout stable &&
+       echo "line1.stable" >a &&
+       echo "line2.stable" >>a &&
+       echo "line3.stable" >>a &&
+       git commit -a -m "lines changed on stable" &&
+       git push origin stable &&
+
+       stable_hash=$(git rev-parse HEAD) &&
+
+       git checkout topic1 &&
+       ! git merge stable &&
+
+       echo "line1.topic" >a &&
+       echo "line2.stable" >>a &&
+       echo "line3.resolved" >>a &&
+       git add a &&
+       git commit -a -m "resolved lines for merging stable into topic1" &&
+       second_stable_hash=$(git rev-parse HEAD) &&
+       git push origin topic1 &&
+
+       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 ../t2204-1.txt 1.txt old_commit_hash old_commit_abbrev new_commit_hash new_commit_abbrev new_commit_date stable_hash &&
+       test_cmp 1.txt server/.git/refs.heads.topic1.out
+'
+
+test_done
+