Add / command in add --patch
[gitweb.git] / http-walker.c
index 51c18f2685aa1bdb7e4ed471d0ec5d31c6684fda..0dbad3c888c6c9441af4d9550fd147ecb5b1aaf3 100644 (file)
@@ -36,7 +36,7 @@ struct object_request
        char errorstr[CURL_ERROR_SIZE];
        long http_code;
        unsigned char real_sha1[20];
-       SHA_CTX c;
+       git_SHA_CTX c;
        z_stream stream;
        int zret;
        int rename;
@@ -82,8 +82,8 @@ static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
        do {
                obj_req->stream.next_out = expn;
                obj_req->stream.avail_out = sizeof(expn);
-               obj_req->zret = inflate(&obj_req->stream, Z_SYNC_FLUSH);
-               SHA1_Update(&obj_req->c, expn,
+               obj_req->zret = git_inflate(&obj_req->stream, Z_SYNC_FLUSH);
+               git_SHA1_Update(&obj_req->c, expn,
                            sizeof(expn) - obj_req->stream.avail_out);
        } while (obj_req->stream.avail_in && obj_req->zret == Z_OK);
        data_received++;
@@ -142,9 +142,9 @@ static void start_object_request(struct walker *walker,
 
        memset(&obj_req->stream, 0, sizeof(obj_req->stream));
 
-       inflateInit(&obj_req->stream);
+       git_inflate_init(&obj_req->stream);
 
-       SHA1_Init(&obj_req->c);
+       git_SHA1_Init(&obj_req->c);
 
        url = xmalloc(strlen(obj_req->repo->base) + 51);
        obj_req->url = xmalloc(strlen(obj_req->repo->base) + 51);
@@ -183,8 +183,8 @@ static void start_object_request(struct walker *walker,
           file; also rewind to the beginning of the local file. */
        if (prev_read == -1) {
                memset(&obj_req->stream, 0, sizeof(obj_req->stream));
-               inflateInit(&obj_req->stream);
-               SHA1_Init(&obj_req->c);
+               git_inflate_init(&obj_req->stream);
+               git_SHA1_Init(&obj_req->c);
                if (prev_posn>0) {
                        prev_posn = 0;
                        lseek(obj_req->local, 0, SEEK_SET);
@@ -243,8 +243,8 @@ static void finish_object_request(struct object_request *obj_req)
                return;
        }
 
-       inflateEnd(&obj_req->stream);
-       SHA1_Final(obj_req->real_sha1, &obj_req->c);
+       git_inflate_end(&obj_req->stream);
+       git_SHA1_Final(obj_req->real_sha1, &obj_req->c);
        if (obj_req->zret != Z_STREAM_END) {
                unlink(obj_req->tmpfile);
                return;
@@ -442,6 +442,8 @@ static int setup_index(struct walker *walker, struct alt_base *repo, unsigned ch
                return -1;
 
        new_pack = parse_pack_index(sha1);
+       if (!new_pack)
+               return -1; /* parse_pack_index() already issued error message */
        new_pack->next = repo->packs;
        repo->packs = new_pack;
        return 0;