Test update/delete annotated tags as well.
authorStephen Haberman <stephen@exigencecorp.com>
Thu, 21 Aug 2008 04:46:17 +0000 (23:46 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Thu, 21 Aug 2008 04:46:17 +0000 (23:46 -0500)
tests/t2201-2.txt
tests/t2201-3.txt
tests/t2201-5.txt
tests/t2201-6.txt
tests/t2201-7.txt [new file with mode: 0644]
tests/t2201-8.txt [new file with mode: 0644]
tests/t2201-server-post-receive-email-tags.sh

index 30577a3..7d962ab 100644 (file)
@@ -20,13 +20,13 @@ commit $prior_commit_hash
 Author: A U Thor <author@example.com>
 Date:   $prior_commit_date
 
-    commit on tag branch
+    commit on annotated tagged branch
 
 commit $new_commit_hash
 Author: A U Thor <author@example.com>
 Date:   $new_commit_date
 
-    commit on tag branch 2
+    commit on annotated tagged branch 2
 
 -----------------------------------------------------------------------
 
@@ -35,12 +35,12 @@ Summary of changes:
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/a b/a
-index 146f275..affecee 100644
+index 146f275..7d07572 100644
 --- a/a
 +++ b/a
 @@ -1 +1 @@
 -setup
-+commit on tag branch 2
++commit on annotated tagged branch 2
 
 
 hooks/post-receive
index cf693cb..e6cd956 100644 (file)
@@ -17,8 +17,8 @@ The annotated tag, 2.0 has been created
 2.0
 
 A U Thor (2):
-      commit on tag branch
-      commit on tag branch 2
+      commit on annotated tagged branch
+      commit on annotated tagged branch 2
 
 -----------------------------------------------------------------------
 
index abd76c7..0c24e42 100644 (file)
@@ -15,7 +15,7 @@ commit $new_commit_hash
 Author: A U Thor <author@example.com>
 Date:   $new_commit_date
 
-    update lightweight tag
+    force update lightweight tag
 -----------------------------------------------------------------------
 
 
index ccc0439..9518253 100644 (file)
@@ -10,7 +10,7 @@ The tag, 2.1 has been deleted
        was  $old_commit_hash
 
 -----------------------------------------------------------------------
-$old_commit_hash update lightweight tag
+$old_commit_hash force update lightweight tag
 -----------------------------------------------------------------------
 
 
diff --git a/tests/t2201-7.txt b/tests/t2201-7.txt
new file mode 100644 (file)
index 0000000..b1b4ece
--- /dev/null
@@ -0,0 +1,30 @@
+From: author@payflex.com
+To: commits@list.com
+Subject: [cbas] 2.0 annotated tag updated. 2.0
+X-Git-Refname: refs/tags/2.0
+X-Git-Reftype: annotated tag
+X-Git-Oldrev: $old_tag_hash
+X-Git-Newrev: $new_tag_hash
+
+The annotated tag, 2.0 has been updated
+        to  $new_tag_hash (tag)
+      from  $old_tag_hash (which is now obsolete)
+   tagging  $new_commit_hash (commit)
+  replaces  1.0
+ tagged by  C O Mitter
+        on  $tag_date
+
+- Log -----------------------------------------------------------------
+2.0
+
+A U Thor (3):
+      commit on annotated tagged branch
+      commit on annotated tagged branch 2
+      force update annotated tag
+
+-----------------------------------------------------------------------
+
+
+hooks/post-receive
+--
+cbas
diff --git a/tests/t2201-8.txt b/tests/t2201-8.txt
new file mode 100644 (file)
index 0000000..90b5925
--- /dev/null
@@ -0,0 +1,24 @@
+From: author@payflex.com
+To: commits@list.com
+Subject: [cbas] 2.0 annotated tag deleted. $new_commit_describe
+X-Git-Refname: refs/tags/2.0
+X-Git-Reftype: annotated tag
+X-Git-Oldrev: $old_tag_hash
+X-Git-Newrev: 0000000000000000000000000000000000000000
+
+The annotated tag, 2.0 has been deleted
+       was  $old_tag_hash
+
+-----------------------------------------------------------------------
+tag 2.0
+Tagger: C O Mitter <committer@example.com>
+Date:   $old_tag_date
+
+2.0
+$new_commit_hash force update annotated tag
+-----------------------------------------------------------------------
+
+
+hooks/post-receive
+--
+cbas
index ce9f8d0..8195671 100644 (file)
@@ -23,7 +23,7 @@ test_expect_success 'setup' '
 
 install_post_receive_hook 'post-receive-email'
 
-test_expect_success 'create tag' '
+test_expect_success 'create annotated tag' '
        git tag -a -m 1.0 1.0 &&
        git push --tags &&
        new_commit_hash=$(git rev-parse HEAD) &&
@@ -34,7 +34,7 @@ test_expect_success 'create tag' '
        test_cmp 1.txt server/.git/refs.tags.1.0.out
 '
 
-test_expect_success 'commit on tag branch' '
+test_expect_success 'commit on annotated tagged branch' '
        old_commit_hash=$(git rev-parse HEAD) &&
        echo "$test_name" >a &&
        git commit -a -m "$test_name" &&
@@ -52,7 +52,7 @@ test_expect_success 'commit on tag branch' '
        test_cmp 2.txt server/.git/refs.heads.master.out
 '
 
-test_expect_success 'retag branch' '
+test_expect_success 're-annotated tag branch' '
        git tag -a -m 2.0 2.0 &&
        git push --tags &&
        new_commit_hash=$(git rev-parse HEAD) &&
@@ -63,6 +63,37 @@ test_expect_success 'retag branch' '
        test_cmp 3.txt server/.git/refs.tags.2.0.out
 '
 
+test_expect_success 'force update annotated tag' '
+       old_tag_hash=$(git rev-parse 2.0) &&
+
+       echo "$test_name" >a &&
+       git commit -a -m "$test_name" &&
+       new_commit_hash=$(git rev-parse HEAD) &&
+       new_commit_date=$(git log -n 1 --pretty=format:%cd HEAD) &&
+
+       git tag -f -a -m 2.0 2.0 &&
+       git push --tags &&
+       new_tag_hash=$(git rev-parse 2.0) &&
+       eval $(git for-each-ref --shell "--format=tag_date=%(taggerdate)" refs/tags/2.0) &&
+
+       interpolate ../t2201-7.txt 7.txt old_tag_hash new_commit_hash new_tag_hash tag_date &&
+       test_cmp 7.txt server/.git/refs.tags.2.0.out
+'
+
+test_expect_success 'delete annotated tag' '
+       old_tag_hash=$(git rev-parse 2.0) &&
+       eval $(git for-each-ref --shell "--format=old_tag_date=%(taggerdate)" refs/tags/2.0) &&
+
+       git tag -d 2.0 &&
+       git push origin :refs/tags/2.0 &&
+
+       new_commit_describe=$(git describe HEAD) &&
+       new_commit_hash=$(git rev-parse HEAD) &&
+
+       interpolate ../t2201-8.txt 8.txt old_tag_hash old_tag_date new_commit_describe new_commit_hash &&
+       test_cmp 8.txt server/.git/refs.tags.2.0.out
+'
+
 test_expect_success 'create lightweight tag' '
        echo "$test_name" >a &&
        git commit -a -m "$test_name" &&
@@ -78,7 +109,7 @@ test_expect_success 'create lightweight tag' '
        test_cmp 4.txt server/.git/refs.tags.2.1.out
 '
 
-test_expect_success 'update lightweight tag' '
+test_expect_success 'force update lightweight tag' '
        old_commit_hash=$(git rev-parse HEAD) &&
        echo "$test_name" >a &&
        git commit -a -m "$test_name" &&