зеркало из https://github.com/microsoft/git.git
packfile: add repository argument to find_pack_entry
While at it move the documentation to the header and mention which pack files are searched. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
4c2a13b4e2
Коммит
613b42f283
|
@ -1845,11 +1845,7 @@ static int fill_pack_entry(const unsigned char *sha1,
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Iff a pack file contains the object named by sha1, return true and
|
||||
* store its location to e.
|
||||
*/
|
||||
int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
|
||||
int find_pack_entry_the_repository(const unsigned char *sha1, struct pack_entry *e)
|
||||
{
|
||||
struct list_head *pos;
|
||||
|
||||
|
@ -1871,7 +1867,7 @@ int find_pack_entry(const unsigned char *sha1, struct pack_entry *e)
|
|||
int has_sha1_pack(const unsigned char *sha1)
|
||||
{
|
||||
struct pack_entry e;
|
||||
return find_pack_entry(sha1, &e);
|
||||
return find_pack_entry(the_repository, sha1, &e);
|
||||
}
|
||||
|
||||
int has_pack_index(const unsigned char *sha1)
|
||||
|
|
|
@ -123,7 +123,12 @@ extern int packed_object_info(struct packed_git *pack, off_t offset, struct obje
|
|||
extern void mark_bad_packed_object(struct packed_git *p, const unsigned char *sha1);
|
||||
extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
|
||||
|
||||
extern int find_pack_entry(const unsigned char *sha1, struct pack_entry *e);
|
||||
/*
|
||||
* Iff a pack file in the given repository contains the object named by sha1,
|
||||
* return true and store its location to e.
|
||||
*/
|
||||
#define find_pack_entry(r, s, e) find_pack_entry_##r(s, e)
|
||||
extern int find_pack_entry_the_repository(const unsigned char *sha1, struct pack_entry *e);
|
||||
|
||||
extern int has_sha1_pack(const unsigned char *sha1);
|
||||
|
||||
|
|
|
@ -1266,7 +1266,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
|
|||
}
|
||||
|
||||
while (1) {
|
||||
if (find_pack_entry(real, &e))
|
||||
if (find_pack_entry(the_repository, real, &e))
|
||||
break;
|
||||
|
||||
/* Most likely it's a loose object. */
|
||||
|
@ -1275,7 +1275,7 @@ int sha1_object_info_extended(const unsigned char *sha1, struct object_info *oi,
|
|||
|
||||
/* Not a loose object; someone else may have just packed it. */
|
||||
reprepare_packed_git(the_repository);
|
||||
if (find_pack_entry(real, &e))
|
||||
if (find_pack_entry(the_repository, real, &e))
|
||||
break;
|
||||
|
||||
/* Check if it is a missing object */
|
||||
|
@ -1655,7 +1655,7 @@ static int freshen_loose_object(const unsigned char *sha1)
|
|||
static int freshen_packed_object(const unsigned char *sha1)
|
||||
{
|
||||
struct pack_entry e;
|
||||
if (!find_pack_entry(sha1, &e))
|
||||
if (!find_pack_entry(the_repository, sha1, &e))
|
||||
return 0;
|
||||
if (e.p->freshened)
|
||||
return 1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче