Merge branch 'pw/doc-synopsis-markup-opmode-options'
[gitweb.git] / remote-curl.c
index 8bba57270b00b72c7e70fe749880a29c1ddfea1f..051f26629d7b9f6679e47f6dc353f09c16c377ae 100644 (file)
@@ -250,7 +250,7 @@ static struct ref *parse_info_refs(struct discovery *heads)
                if (data[i] == '\t')
                        mid = &data[i];
                if (data[i] == '\n') {
-                       if (mid - start != 40)
+                       if (mid - start != the_hash_algo->hexsz)
                                die(_("%sinfo/refs not valid: is this a git repository?"),
                                    transport_anonymize_url(url.buf));
                        data[i] = 0;
@@ -1114,15 +1114,16 @@ static void parse_fetch(struct strbuf *buf)
                        const char *name;
                        struct ref *ref;
                        struct object_id old_oid;
+                       const char *q;
 
-                       if (get_oid_hex(p, &old_oid))
-                               die(_("protocol error: expected sha/ref, got %s'"), p);
-                       if (p[GIT_SHA1_HEXSZ] == ' ')
-                               name = p + GIT_SHA1_HEXSZ + 1;
-                       else if (!p[GIT_SHA1_HEXSZ])
+                       if (parse_oid_hex(p, &old_oid, &q))
+                               die(_("protocol error: expected sha/ref, got '%s'"), p);
+                       if (*q == ' ')
+                               name = q + 1;
+                       else if (!*q)
                                name = "";
                        else
-                               die(_("protocol error: expected sha/ref, got %s'"), p);
+                               die(_("protocol error: expected sha/ref, got '%s'"), p);
 
                        ref = alloc_ref(name);
                        oidcpy(&ref->old_oid, &old_oid);