summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-10-07 10:20:23 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-10-07 10:20:23 +0200
commit22935b06d160c8b33e90784d43480859ca65d3b6 (patch)
treedbce4ebe5c4142bfd5aa81f506d46b3700412ffd
parentf9cf12b4f58588309c0329d0525f1505f579c32d (diff)
downloadlibgit2-22935b06d160c8b33e90784d43480859ca65d3b6.tar.gz
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.
-rw-r--r--src/protocol.c6
1 files 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;