Merge fighting fsck-cache updates from Junio
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 28 Jun 2005 22:20:10 +0000 (15:20 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 28 Jun 2005 22:20:10 +0000 (15:20 -0700)
It's just easier to let git help out with the merge than it is to try to
fix up the diffs.

1  2 
sha1_file.c
diff --cc sha1_file.c
index 5c6e964a35d973fde9d3d29d643552324bcb15f3,17546061c15175275b6dce2949e73281d8d9d7ce..25208d2da365a0a670d2ef2adf4dcbcf60ee910a
@@@ -839,9 -806,25 +828,25 @@@ static void *unpack_entry(struct pack_e
                die("corrupted pack file");
        }
        *sizep = size;
 -      return unpack_non_delta_entry(pack+5, size, left);
 +      return unpack_non_delta_entry(pack, size, left);
  }
  
+ int num_packed_objects(const struct packed_git *p)
+ {
+       /* See check_packed_git_idx and pack-objects.c */
+       return (p->index_size - 20 - 20 - 4*256) / 24;
+ }
+ int nth_packed_object_sha1(const struct packed_git *p, int n,
+                          unsigned char* sha1)
+ {
+       void *index = p->index_base + 256;
+       if (n < 0 || num_packed_objects(p) <= n)
+               return -1;
+       memcpy(sha1, (index + 24 * n + 4), 20);
+       return 0;
+ }
  static int find_pack_entry_1(const unsigned char *sha1,
                             struct pack_entry *e, struct packed_git *p)
  {