bulk-checkin: zero-initialize hashfile_checkpoint
[gitweb.git] / serve.c
diff --git a/serve.c b/serve.c
index 1cb5fb9b5b57de77b3b7d40301e67912b07a8849..317256c1a493c4b2cc730a6212add4d1ef5696d4 100644 (file)
--- a/serve.c
+++ b/serve.c
@@ -6,6 +6,7 @@
 #include "argv-array.h"
 #include "ls-refs.h"
 #include "serve.h"
+#include "upload-pack.h"
 
 static int always_advertise(struct repository *r,
                            struct strbuf *value)
@@ -54,6 +55,8 @@ struct protocol_capability {
 static struct protocol_capability capabilities[] = {
        { "agent", agent_advertise, NULL },
        { "ls-refs", always_advertise, ls_refs },
+       { "fetch", upload_pack_advertise, upload_pack_v2 },
+       { "server-option", always_advertise, NULL },
 };
 
 static void advertise_capabilities(void)
@@ -164,7 +167,8 @@ static int process_request(void)
 
        packet_reader_init(&reader, 0, NULL, 0,
                           PACKET_READ_CHOMP_NEWLINE |
-                          PACKET_READ_GENTLE_ON_EOF);
+                          PACKET_READ_GENTLE_ON_EOF |
+                          PACKET_READ_DIE_ON_ERR_PACKET);
 
        /*
         * Check to see if the client closed their end before sending another
@@ -172,7 +176,7 @@ static int process_request(void)
         */
        if (packet_reader_peek(&reader) == PACKET_READ_EOF)
                return 1;
-       reader.options = PACKET_READ_CHOMP_NEWLINE;
+       reader.options &= ~PACKET_READ_GENTLE_ON_EOF;
 
        while (state != PROCESS_REQUEST_DONE) {
                switch (packet_reader_peek(&reader)) {