]> git.ipfire.org Git - thirdparty/git.git/blobdiff - index-pack.c
diff --quiet
[thirdparty/git.git] / index-pack.c
index 48874a052a8be22c50fdbb8b4b707af2d49c4859..b405864be954941dedc4b0cc0c7f7aefcf65dd2d 100644 (file)
@@ -463,7 +463,8 @@ static void parse_pack_objects(unsigned char *sha1)
        /* If input_fd is a file, we should have reached its end now. */
        if (fstat(input_fd, &st))
                die("cannot fstat packfile: %s", strerror(errno));
-       if (S_ISREG(st.st_mode) && st.st_size != consumed_bytes)
+       if (S_ISREG(st.st_mode) &&
+                       lseek(input_fd, 0, SEEK_CUR) - input_len != st.st_size)
                die("pack has junk at the end");
 
        if (!nr_deltas)
@@ -601,30 +602,23 @@ static void fix_unresolved_deltas(int nr_unresolved)
                struct delta_entry *d = sorted_by_pos[i];
                void *data;
                unsigned long size;
-               char type[10];
-               enum object_type obj_type;
+               enum object_type type;
                int j, first, last;
 
                if (objects[d->obj_no].real_type != OBJ_REF_DELTA)
                        continue;
-               data = read_sha1_file(d->base.sha1, type, &size);
+               data = read_sha1_file(d->base.sha1, &type, &size);
                if (!data)
                        continue;
-               if      (!strcmp(type, blob_type))   obj_type = OBJ_BLOB;
-               else if (!strcmp(type, tree_type))   obj_type = OBJ_TREE;
-               else if (!strcmp(type, commit_type)) obj_type = OBJ_COMMIT;
-               else if (!strcmp(type, tag_type))    obj_type = OBJ_TAG;
-               else die("base object %s is of type '%s'",
-                        sha1_to_hex(d->base.sha1), type);
 
                find_delta_children(&d->base, &first, &last);
                for (j = first; j <= last; j++) {
                        struct object_entry *child = objects + deltas[j].obj_no;
                        if (child->real_type == OBJ_REF_DELTA)
-                               resolve_delta(child, data, size, obj_type);
+                               resolve_delta(child, data, size, type);
                }
 
-               append_obj_to_pack(data, size, obj_type);
+               append_obj_to_pack(data, size, type);
                free(data);
                if (verbose)
                        percent = display_progress(nr_resolved_deltas,
@@ -759,7 +753,7 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
                  const char *keep_name, const char *keep_msg,
                  unsigned char *sha1)
 {
-       char *report = "pack";
+       const char *report = "pack";
        char name[PATH_MAX];
        int err;