summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
013aab8)
This reverses the order of object lookup, to check pack index first and
then go to the filesystem to find .git/objects/??/ hierarchy.
When most of the objects are packed, this saves quite many stat() calls
and negative dcache entries; while the price this approach has to pay is
negligible, even when most of the objects are outside pack, because
checking pack index file is quite cheap.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
{
unsigned long mapsize;
void *map, *buf;
{
unsigned long mapsize;
void *map, *buf;
+ if (find_pack_entry(sha1, &e))
+ return read_packed_sha1(sha1, type, size);
map = map_sha1_file_internal(sha1, &mapsize);
if (map) {
buf = unpack_sha1_file(map, mapsize, type, size);
munmap(map, mapsize);
return buf;
}
map = map_sha1_file_internal(sha1, &mapsize);
if (map) {
buf = unpack_sha1_file(map, mapsize, type, size);
munmap(map, mapsize);
return buf;
}
- return read_packed_sha1(sha1, type, size);
}
void *read_object_with_reference(const unsigned char *sha1,
}
void *read_object_with_reference(const unsigned char *sha1,
struct stat st;
struct pack_entry e;
struct stat st;
struct pack_entry e;
- if (find_sha1_file(sha1, &st))
+ if (find_pack_entry(sha1, &e))
- return find_pack_entry(sha1, &e);
+ return find_sha1_file(sha1, &st) ? 1 : 0;
}
int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, const char *type)
}
int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, const char *type)