Merge branch 'for-junio' of git://bogomips.org/git-svn
[gitweb.git] / t / t5516-fetch-push.sh
index b69cf574d7e9a272ea70864e87ed6556abe94f13..8f024a08f0b175c12747c33ac0a07cacb73937d9 100755 (executable)
@@ -368,7 +368,7 @@ test_expect_success 'push with colon-less refspec (2)' '
                git branch -D frotz
        fi &&
        git tag -f frotz &&
-       git push testrepo frotz &&
+       git push -f testrepo frotz &&
        check_push_result $the_commit tags/frotz &&
        check_push_result $the_first_commit heads/frotz
 
@@ -929,6 +929,27 @@ test_expect_success 'push into aliased refs (inconsistent)' '
        )
 '
 
+test_expect_success 'push requires --force to update lightweight tag' '
+       mk_test heads/master &&
+       mk_child child1 &&
+       mk_child child2 &&
+       (
+               cd child1 &&
+               git tag Tag &&
+               git push ../child2 Tag &&
+               git push ../child2 Tag &&
+               >file1 &&
+               git add file1 &&
+               git commit -m "file1" &&
+               git tag -f Tag &&
+               test_must_fail git push ../child2 Tag &&
+               git push --force ../child2 Tag &&
+               git tag -f Tag &&
+               test_must_fail git push ../child2 Tag HEAD~ &&
+               git push --force ../child2 Tag
+       )
+'
+
 test_expect_success 'push --porcelain' '
        mk_empty &&
        echo >.git/foo  "To testrepo" &&
@@ -979,4 +1000,20 @@ test_expect_success 'push --porcelain --dry-run rejected' '
        test_cmp .git/foo .git/bar
 '
 
+test_expect_success 'push --prune' '
+       mk_test heads/master heads/second heads/foo heads/bar &&
+       git push --prune testrepo &&
+       check_push_result $the_commit heads/master &&
+       check_push_result $the_first_commit heads/second &&
+       ! check_push_result $the_first_commit heads/foo heads/bar
+'
+
+test_expect_success 'push --prune refspec' '
+       mk_test tmp/master tmp/second tmp/foo tmp/bar &&
+       git push --prune testrepo "refs/heads/*:refs/tmp/*" &&
+       check_push_result $the_commit tmp/master &&
+       check_push_result $the_first_commit tmp/second &&
+       ! check_push_result $the_first_commit tmp/foo tmp/bar
+'
+
 test_done