Add more test coverage to the atomic push option. It turns out there is a
breakage when renaming branches within an atomic push. The breakage occurs
because it cannot lock the refs v/v as well as x.

Signed-off-by: Stefan Beller <sbel...@google.com>
---
 t/t5543-atomic-push.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/t/t5543-atomic-push.sh b/t/t5543-atomic-push.sh
index 3480b33..96a106b 100755
--- a/t/t5543-atomic-push.sh
+++ b/t/t5543-atomic-push.sh
@@ -191,4 +191,53 @@ test_expect_success 'atomic push is not advertised if 
configured' '
        test_refs master HEAD@{1}
 '
 
+test_expect_success 'atomic push handles deletes gracefully' '
+       mk_repo_pair &&
+       (
+               cd workbench &&
+               git checkout -b todelete &&
+               test_commit one &&
+               git push --mirror up
+       ) &&
+       (
+               cd workbench &&
+               git checkout -b anotherbranch &&
+               git branch -D todelete &&
+               git push --mirror --atomic up
+       )
+'
+
+test_expect_failure 'atomic push handles renames gracefully' '
+       # First push to upstream having the following branches:
+       # v, x/x, x/y and y/z. Now rename them and push atomically:
+       # v   -> v/v (1)
+       # x/x -> x   (2)
+       # x/y -> y   (3)
+       # y/z -> z   (4)
+       # (1) and (2) test (directory/file) conflicts on the branch itself. (3)
+       # is testing the (D/F) conflict with another branch involved which is
+       # freed in (4)
+       mk_repo_pair &&
+       (
+               cd workbench &&
+               git checkout -b v &&
+               test_commit one &&
+               git checkout -b x/x &&
+               test_commit two &&
+               git checkout -b x/y &&
+               test_commit three &&
+               git checkout -b y/z &&
+               test_commit four &&
+               git push --mirror up
+       ) &&
+       (
+               cd workbench &&
+               git branch -m y/z z &&
+               git branch -m x/y y &&
+               git branch -m x/x x &&
+               git branch -m v v/v &&
+               git push --atomic up :v :x/x :x/y :y/z v/v x y z
+       )
+'
+
 test_done
-- 
2.2.1.62.g3f15098

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to