From 377377985ec7dffc8b7414d42fea98b1145b19f5 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Thu, 21 Aug 2008 01:19:33 -0500 Subject: [PATCH] Test how merges with and without conflicts are currently rendered. --- tests/t2203-1.txt | 60 ++++++++++ tests/t2203-2.txt | 63 +++++++++++ .../t2203-server-post-receive-email-stable.sh | 104 ++++++++++++++++++ 3 files changed, 227 insertions(+) create mode 100644 tests/t2203-1.txt create mode 100644 tests/t2203-2.txt create mode 100644 tests/t2203-server-post-receive-email-stable.sh diff --git a/tests/t2203-1.txt b/tests/t2203-1.txt new file mode 100644 index 0000000..b7e0812 --- /dev/null +++ b/tests/t2203-1.txt @@ -0,0 +1,60 @@ +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_hash (commit) + via $second_stable_hash (commit) + via $first_stable_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 $new_commit_hash +Merge: $old_commit_hash $second_stable_hash +Author: A U Thor +Date: $new_commit_date + + Merge branch 'stable' into topic1 + +----------------------------------------------------------------------- + +Summary of changes: + a | 2 +- + b | 2 +- + c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/a b/a +index 146f275..1c043c5 100644 +--- a/a ++++ b/a +@@ -1 +1 @@ +-setup ++merge in stable 2 +diff --git a/b b/b +index 146f275..1c043c5 100644 +--- a/b ++++ b/b +@@ -1 +1 @@ +-setup ++merge in stable 2 +diff --git a/c b/c +index 146f275..1c043c5 100644 +--- a/c ++++ b/c +@@ -1 +1 @@ +-setup ++merge in stable 2 + + +hooks/post-receive +-- +cbas diff --git a/tests/t2203-2.txt b/tests/t2203-2.txt new file mode 100644 index 0000000..b7de3f1 --- /dev/null +++ b/tests/t2203-2.txt @@ -0,0 +1,63 @@ +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_hash (commit) + via $second_stable_hash (commit) + via $first_stable_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 $new_commit_hash +Merge: $old_commit_hash $second_stable_hash +Author: A U Thor +Date: $new_commit_date + + Merge branch 'stable' into topic1 + + Conflicts: + a + +----------------------------------------------------------------------- + +Summary of changes: + a | 2 +- + b | 2 +- + c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/a b/a +index a67d715..01a17ba 100644 +--- a/a ++++ b/a +@@ -1 +1 @@ +-merge in stable with conflict on topic1 ++merge in stable with conflict 2 merged topic1 +diff --git a/b b/b +index 1c043c5..96d4816 100644 +--- a/b ++++ b/b +@@ -1 +1 @@ +-merge in stable 2 ++merge in stable with conflict 2 +diff --git a/c b/c +index 1c043c5..96d4816 100644 +--- a/c ++++ b/c +@@ -1 +1 @@ +-merge in stable 2 ++merge in stable with conflict 2 + + +hooks/post-receive +-- +cbas diff --git a/tests/t2203-server-post-receive-email-stable.sh b/tests/t2203-server-post-receive-email-stable.sh new file mode 100644 index 0000000..af58820 --- /dev/null +++ b/tests/t2203-server-post-receive-email-stable.sh @@ -0,0 +1,104 @@ +#!/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 'merge in stable' ' + git checkout -b topic1 stable && + echo "move" >a.topic1 && + git add a.topic1 && + git commit -a -m "move topic1" && + git push origin topic1 && + old_commit_hash=$(git rev-parse HEAD) && + + # Move stable + git checkout stable && + echo "$test_name 1" >a && + echo "$test_name 1" >b && + echo "$test_name 1" >c && + git commit -a -m "move stable 1" && + first_stable_hash=$(git rev-parse HEAD) && + + echo "$test_name 2" >a && + echo "$test_name 2" >b && + echo "$test_name 2" >c && + git commit -a -m "move stable 2" && + second_stable_hash=$(git rev-parse HEAD) && + git push origin stable && + + # Merge stable + git checkout topic1 && + git merge stable && + git push && + + new_commit_hash=$(git rev-parse HEAD) && + new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) && + + interpolate ../t2203-1.txt 1.txt old_commit_hash new_commit_hash new_commit_date first_stable_hash second_stable_hash && + test_cmp 1.txt server/.git/refs.heads.topic1.out +' + +test_expect_success 'merge in stable with conflict' ' + git checkout topic1 && + echo "$test_name on topic1" >a && + git commit -a -m "move topic1" && + git push origin topic1 && + old_commit_hash=$(git rev-parse HEAD) && + + # Move stable + git checkout stable && + echo "$test_name 1" >a && + echo "$test_name 1" >b && + echo "$test_name 1" >c && + git commit -a -m "move stable 1" && + first_stable_hash=$(git rev-parse HEAD) && + + echo "$test_name 2" >a && + echo "$test_name 2" >b && + echo "$test_name 2" >c && + git commit -a -m "move stable 2" && + second_stable_hash=$(git rev-parse HEAD) && + git push origin stable && + + # Merge stable + git checkout topic1 && + ! git merge stable && + echo "$test_name 2 merged topic1" >a && + git add a && + git commit -F .git/MERGE_MSG + git push && + + new_commit_hash=$(git rev-parse HEAD) && + new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) && + + interpolate ../t2203-2.txt 2.txt old_commit_hash new_commit_hash new_commit_date first_stable_hash second_stable_hash && + test_cmp 2.txt server/.git/refs.heads.topic1.out +' + +test_done + -- 2.39.5