Merge branch 'rs/pop-commit'
[gitweb.git] / t / t7004-tag.sh
index d1ff5c94f2f3241b3b1ed436d0011280986abab7..3dd2f51e49d7e6824382ac415cf64842fa3b757f 100755 (executable)
@@ -51,7 +51,19 @@ test_expect_success 'creating a tag using default HEAD should succeed' '
        echo foo >foo &&
        git add foo &&
        git commit -m Foo &&
-       git tag mytag
+       git tag mytag &&
+       test_must_fail git reflog exists refs/tags/mytag
+'
+
+test_expect_success 'creating a tag with --create-reflog should create reflog' '
+       test_when_finished "git tag -d tag_with_reflog" &&
+       git tag --create-reflog tag_with_reflog &&
+       git reflog exists refs/tags/tag_with_reflog
+'
+
+test_expect_success '--create-reflog does not create reflog on failure' '
+       test_must_fail git tag --create-reflog mytag &&
+       test_must_fail git reflog exists refs/tags/mytag
 '
 
 test_expect_success 'listing all tags if one exists should succeed' '
@@ -1450,13 +1462,7 @@ test_expect_success 'invalid sort parameter on command line' '
 
 test_expect_success 'invalid sort parameter in configuratoin' '
        git config tag.sort "v:notvalid" &&
-       git tag -l "foo*" >actual &&
-       cat >expect <<-\EOF &&
-       foo1.10
-       foo1.3
-       foo1.6
-       EOF
-       test_cmp expect actual
+       test_must_fail git tag -l "foo*"
 '
 
 test_expect_success 'version sort with prerelease reordering' '
@@ -1513,4 +1519,43 @@ EOF"
        test_cmp expect actual
 '
 
+test_expect_success '--format should list tags as per format given' '
+       cat >expect <<-\EOF &&
+       refname : refs/tags/foo1.10
+       refname : refs/tags/foo1.3
+       refname : refs/tags/foo1.6
+       refname : refs/tags/foo1.6-rc1
+       refname : refs/tags/foo1.6-rc2
+       EOF
+       git tag -l --format="refname : %(refname)" "foo*" >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'setup --merged test tags' '
+       git tag mergetest-1 HEAD~2 &&
+       git tag mergetest-2 HEAD~1 &&
+       git tag mergetest-3 HEAD
+'
+
+test_expect_success '--merged cannot be used in non-list mode' '
+       test_must_fail git tag --merged=mergetest-2 foo
+'
+
+test_expect_success '--merged shows merged tags' '
+       cat >expect <<-\EOF &&
+       mergetest-1
+       mergetest-2
+       EOF
+       git tag -l --merged=mergetest-2 mergetest-* >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success '--no-merged show unmerged tags' '
+       cat >expect <<-\EOF &&
+       mergetest-3
+       EOF
+       git tag -l --no-merged=mergetest-2 mergetest-* >actual &&
+       test_cmp expect actual
+'
+
 test_done