sha1_object_info_extended: provide delta base sha1s
[gitweb.git] / upload-pack.c
index fd96f3be116fa3655d8a0f297bcd6c6c4fec5cb7..ec56cdbce9fe0bf87aeafb3567e09cbf546e7218 100644 (file)
@@ -10,6 +10,7 @@
 #include "revision.h"
 #include "list-objects.h"
 #include "run-command.h"
+#include "connect.h"
 #include "sigchain.h"
 #include "version.h"
 #include "string-list.h"
@@ -393,7 +394,7 @@ static int get_common_commits(void)
                        got_other = 0;
                        continue;
                }
-               if (!prefixcmp(line, "have ")) {
+               if (starts_with(line, "have ")) {
                        switch (got_sha1(line+5, sha1)) {
                        case -1: /* they have what we do not */
                                got_other = 1;
@@ -539,7 +540,7 @@ static void receive_needs(void)
                if (!line)
                        break;
 
-               if (!prefixcmp(line, "shallow ")) {
+               if (starts_with(line, "shallow ")) {
                        unsigned char sha1[20];
                        struct object *object;
                        if (get_sha1_hex(line + 8, sha1))
@@ -555,14 +556,14 @@ static void receive_needs(void)
                        }
                        continue;
                }
-               if (!prefixcmp(line, "deepen ")) {
+               if (starts_with(line, "deepen ")) {
                        char *end;
                        depth = strtol(line + 7, &end, 0);
                        if (end == line + 7 || depth <= 0)
                                die("Invalid deepen: %s", line);
                        continue;
                }
-               if (prefixcmp(line, "want ") ||
+               if (!starts_with(line, "want ") ||
                    get_sha1_hex(line+5, sha1_buf))
                        die("git upload-pack: protocol error, "
                            "expected to get sha, not '%s'", line);
@@ -648,8 +649,7 @@ static void receive_needs(void)
                                /* make sure the real parents are parsed */
                                unregister_shallow(object->sha1);
                                object->parsed = 0;
-                               if (parse_commit((struct commit *)object))
-                                       die("invalid commit");
+                               parse_commit_or_die((struct commit *)object);
                                parents = ((struct commit *)object)->parents;
                                while (parents) {
                                        add_object_array(&parents->item->object,
@@ -752,7 +752,6 @@ static void upload_pack(void)
        struct string_list symref = STRING_LIST_INIT_DUP;
 
        head_ref_namespaced(find_symref, &symref);
-       for_each_namespaced_ref(find_symref, &symref);
 
        if (advertise_refs || !stateless_rpc) {
                reset_timeout();
@@ -815,7 +814,7 @@ int main(int argc, char **argv)
                        strict = 1;
                        continue;
                }
-               if (!prefixcmp(arg, "--timeout=")) {
+               if (starts_with(arg, "--timeout=")) {
                        timeout = atoi(arg+10);
                        daemon_mode = 1;
                        continue;