From 22935b06d160c8b33e90784d43480859ca65d3b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 7 Oct 2012 10:20:23 +0200 Subject: [PATCH] protocol: don't store flushes Storing flushes in the refs vector doesn't let us recognize when the remote is empty, as we'd always introduce at least one element into it. These flushes aren't necessary, so we can simply ignore them. --- src/protocol.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/protocol.c b/src/protocol.c index 8f673cda7..affad5173 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -45,11 +45,13 @@ int git_protocol_store_refs(git_transport *t, int flushes) return -1; } - if (git_vector_insert(refs, pkt) < 0) + if (pkt->type != GIT_PKT_FLUSH && git_vector_insert(refs, pkt) < 0) return -1; - if (pkt->type == GIT_PKT_FLUSH) + if (pkt->type == GIT_PKT_FLUSH) { flush++; + git_pkt_free(pkt); + } } while (flush < flushes); return flush;