summaryrefslogtreecommitdiff
path: root/tests-clar/online/push.c
diff options
context:
space:
mode:
authorCongyi Wu <congyiwu@gmail.com>2013-01-03 13:26:11 -0500
committerVicent Marti <tanoku@gmail.com>2013-01-04 17:47:51 +0100
commitd73d52dfcb589b1bc09a5ed7c4f39b0ddc21e2a9 (patch)
tree951fe627056292d87e60eeab2dbb1b0103d17005 /tests-clar/online/push.c
parent931b8b709c0d2e1f42f258f61e88e457db9e4275 (diff)
downloadlibgit2-d73d52dfcb589b1bc09a5ed7c4f39b0ddc21e2a9.tar.gz
Fix bug in gen_pktline() for deletes of missing remote refs
* gen_pktline() in smart_protocol.c was skipping refspecs that deleted refs that were not advertised by the server. The new behavior is to send a delete command with an old-id of zero, which matches the behavior of the official git client. * Update test_network_push__delete() in reaction to above fix. * Obviate messy logic that handles missing push_spec rrefs by canonicalizing push_spec. After calculate_work(), loid, roid, and rref, are filled in with exactly what is sent to the server
Diffstat (limited to 'tests-clar/online/push.c')
-rw-r--r--tests-clar/online/push.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests-clar/online/push.c b/tests-clar/online/push.c
index d8ee4c2ee..9d949b77b 100644
--- a/tests-clar/online/push.c
+++ b/tests-clar/online/push.c
@@ -451,6 +451,7 @@ void test_online_push__delete(void)
const char *specs_del_fake[] = { ":refs/heads/fake" };
/* Force has no effect for delete. */
const char *specs_del_fake_force[] = { "+:refs/heads/fake" };
+ push_status exp_stats_fake[] = { { "refs/heads/fake", NULL } };
const char *specs_delete[] = { ":refs/heads/tgt1" };
push_status exp_stats_delete[] = { { "refs/heads/tgt1", NULL } };
@@ -462,15 +463,18 @@ void test_online_push__delete(void)
exp_stats1, ARRAY_SIZE(exp_stats1),
exp_refs1, ARRAY_SIZE(exp_refs1), 0);
- /* Deleting a non-existent branch should fail before the request is sent to
- * the server because the client cannot find the old oid for the ref.
+ /* When deleting a non-existent branch, the git client sends zero for both
+ * the old and new commit id. This should succeed on the server with the
+ * same status report as if the branch were actually deleted. The server
+ * returns a warning on the side-band iff the side-band is supported.
+ * Since libgit2 doesn't support the side-band yet, there are no warnings.
*/
do_push(specs_del_fake, ARRAY_SIZE(specs_del_fake),
- NULL, 0,
- exp_refs1, ARRAY_SIZE(exp_refs1), -1);
+ exp_stats_fake, 1,
+ exp_refs1, ARRAY_SIZE(exp_refs1), 0);
do_push(specs_del_fake_force, ARRAY_SIZE(specs_del_fake_force),
- NULL, 0,
- exp_refs1, ARRAY_SIZE(exp_refs1), -1);
+ exp_stats_fake, 1,
+ exp_refs1, ARRAY_SIZE(exp_refs1), 0);
/* Delete one of the pushed branches. */
do_push(specs_delete, ARRAY_SIZE(specs_delete),