]> git.droids-corp.org - git-central.git/commitdiff
Test update/delete lightweight tags.
authorStephen Haberman <stephen@exigencecorp.com>
Thu, 21 Aug 2008 04:22:43 +0000 (23:22 -0500)
committerStephen Haberman <stephen@exigencecorp.com>
Thu, 21 Aug 2008 04:22:43 +0000 (23:22 -0500)
tests/t2201-5.txt [new file with mode: 0644]
tests/t2201-6.txt [new file with mode: 0644]
tests/t2201-server-post-receive-email-tags.sh

diff --git a/tests/t2201-5.txt b/tests/t2201-5.txt
new file mode 100644 (file)
index 0000000..abd76c7
--- /dev/null
@@ -0,0 +1,24 @@
+From: author@payflex.com
+To: commits@list.com
+Subject: [cbas] 2.1 tag updated. $new_commit_describe
+X-Git-Refname: refs/tags/2.1
+X-Git-Reftype: tag
+X-Git-Oldrev: $old_commit_hash
+X-Git-Newrev: $new_commit_hash
+
+The tag, 2.1 has been updated
+        to  $new_commit_hash (commit)
+      from  $old_commit_hash
+
+- Log -----------------------------------------------------------------
+commit $new_commit_hash
+Author: A U Thor <author@example.com>
+Date:   $new_commit_date
+
+    update lightweight tag
+-----------------------------------------------------------------------
+
+
+hooks/post-receive
+--
+cbas
diff --git a/tests/t2201-6.txt b/tests/t2201-6.txt
new file mode 100644 (file)
index 0000000..ccc0439
--- /dev/null
@@ -0,0 +1,19 @@
+From: author@payflex.com
+To: commits@list.com
+Subject: [cbas] 2.1 tag deleted. $old_commit_describe
+X-Git-Refname: refs/tags/2.1
+X-Git-Reftype: tag
+X-Git-Oldrev: $old_commit_hash
+X-Git-Newrev: 0000000000000000000000000000000000000000
+
+The tag, 2.1 has been deleted
+       was  $old_commit_hash
+
+-----------------------------------------------------------------------
+$old_commit_hash update lightweight tag
+-----------------------------------------------------------------------
+
+
+hooks/post-receive
+--
+cbas
index bcd23cdbb535d01d290e0c0ce38f712bf222225b..ce9f8d0df6336287e3d1cc2ebc429e1ebae7407d 100644 (file)
@@ -66,7 +66,7 @@ test_expect_success 'retag branch' '
 test_expect_success 'create lightweight tag' '
        echo "$test_name" >a &&
        git commit -a -m "$test_name" &&
-    git push &&
+       git push &&
 
        git tag 2.1 &&
        git push --tags &&
@@ -78,5 +78,31 @@ test_expect_success 'create lightweight tag' '
        test_cmp 4.txt server/.git/refs.tags.2.1.out
 '
 
+test_expect_success 'update lightweight tag' '
+       old_commit_hash=$(git rev-parse HEAD) &&
+       echo "$test_name" >a &&
+       git commit -a -m "$test_name" &&
+       git push &&
+
+       git tag -f 2.1 &&
+       git push --tags &&
+       new_commit_hash=$(git rev-parse HEAD) &&
+       new_commit_describe=$(git describe HEAD) &&
+       new_commit_date=$(git rev-list --no-walk --pretty=format:%ad HEAD | tail -n 1) &&
+
+       interpolate ../t2201-5.txt 5.txt new_commit_hash new_commit_describe new_commit_date old_commit_hash &&
+       test_cmp 5.txt server/.git/refs.tags.2.1.out
+'
+
+test_expect_success 'delete lightweight tag' '
+       old_commit_hash=$(git rev-parse HEAD) &&
+       old_commit_describe=$(git describe HEAD) &&
+       git tag -d 2.1 &&
+       git push origin :refs/tags/2.1 &&
+
+       interpolate ../t2201-6.txt 6.txt old_commit_hash old_commit_describe &&
+       test_cmp 6.txt server/.git/refs.tags.2.1.out
+'
+
 test_done