From: Stephen Haberman Date: Sun, 28 Sep 2008 06:49:48 +0000 (-0500) Subject: Test the conflict diff email. X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=a1daa17fa2267c3f2a14f09057c0ffe3f74cfabb;p=git-central.git Test the conflict diff email. --- diff --git a/tests/t2204-1.txt b/tests/t2204-1.txt new file mode 100644 index 0000000..4b7d92b --- /dev/null +++ b/tests/t2204-1.txt @@ -0,0 +1,45 @@ +From: author@payflex.com +To: commits@list.com +Subject: [cbas] topic1 branch updated. $new_commit_hash +X-Git-Refname: refs/heads/topic1 +X-Git-Reftype: branch +X-Git-Oldrev: $old_commit_hash +X-Git-Newrev: $new_commit_hash + +The branch, topic1 has been updated + via $new_commit_abbrev resolved lines for merging stable into topic1 + from $old_commit_abbrev lines changed on topic1 + +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 +Merge: $old_commit_hash $stable_hash +Author: A U Thor +Date: $new_commit_date + + resolved lines for merging stable into topic1 + +$new_commit_hash +diff --cc a +index d288e69,a9ccdfe..3f45f93 +--- a/a ++++ b/a +@@@ -1,3 -1,3 +1,3 @@@ +- line1.topic1 +- line2.topic1 +- line3.topic1 + -line1.stable +++line1.topic ++ line2.stable + -line3.stable +++line3.resolved + +----------------------------------------------------------------------- + +Summary of changes: + a | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/t2204-server-post-receive-email-conflicts.sh b/tests/t2204-server-post-receive-email-conflicts.sh new file mode 100644 index 0000000..45b7cb9 --- /dev/null +++ b/tests/t2204-server-post-receive-email-conflicts.sh @@ -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 +