]> git.proxmox.com Git - libgit2.git/commitdiff
protocol: don't store flushes
authorCarlos Martín Nieto <carlos@cmartin.tk>
Sun, 7 Oct 2012 08:20:23 +0000 (10:20 +0200)
committerCarlos Martín Nieto <carlos@cmartin.tk>
Sun, 7 Oct 2012 08:20:23 +0000 (10:20 +0200)
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

index 8f673cda74afa1aa142b7e1f9179cc0bd8162538..affad5173d547b925adb4a69ae9af23863fee706 100644 (file)
@@ -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;