Skip to contentSkip to conversation

t5543, atomic pushes: test deleting and renaming branches

PATCH New Stefan Beller 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t5543, atomic pushes: test deleting and renaming branches

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.

---
 t/t5543-atomic-push.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
t/t5543-atomic-push.sh +49 -0
index 3480b33..96a106b 100755
@@ -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
Signature · 1 line
2.2.1.62.g3f15098