Code

Merge commit 'v1.6.0' into jc/checkout-reflog-fix
[git.git] / t / t5517-push-mirror.sh
index ed3fec192a8da73da269af03746fa7e9eda65d52..ea49dedbf8867694d83cd550c8212ff107361920 100755 (executable)
@@ -25,7 +25,7 @@ mk_repo_pair () {
        (
                cd master &&
                git init &&
-               git config remote.up.url ../mirror
+               git remote add $1 up ../mirror
        )
 }
 
@@ -225,4 +225,43 @@ test_expect_success 'push mirror adds, updates and removes tags together' '
 
 '
 
+test_expect_success 'remote.foo.mirror adds and removes branches' '
+
+       mk_repo_pair --mirror &&
+       (
+               cd master &&
+               echo one >foo && git add foo && git commit -m one &&
+               git branch keep master &&
+               git branch remove master &&
+               git push up &&
+               git branch -D remove
+               git push up
+       ) &&
+       (
+               cd mirror &&
+               git show-ref -s --verify refs/heads/keep &&
+               invert git show-ref -s --verify refs/heads/remove
+       )
+
+'
+
+test_expect_success 'remote.foo.mirror=no has no effect' '
+
+       mk_repo_pair &&
+       (
+               cd master &&
+               echo one >foo && git add foo && git commit -m one &&
+               git config --add remote.up.mirror no &&
+               git branch keep master &&
+               git push --mirror up &&
+               git branch -D keep &&
+               git push up
+       ) &&
+       (
+               cd mirror &&
+               git show-ref -s --verify refs/heads/keep
+       )
+
+'
+
 test_done