Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-05-02 03:25:35 +0300
committerJunio C Hamano <gitster@pobox.com>2018-05-02 07:59:49 +0300
commit544443cb3cca4d5e48dfd8bd3c704a7e52b89ee6 (patch)
tree1bf195b440166774334d9da103c284abfaee6f65
parent6862ebbfcbdd44b68dbdcfecd432432bdf22b2e5 (diff)
packfile: convert find_pack_entry to object_id
Convert find_pack_entry and the static function fill_pack_entry to take pointers to struct object_id. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--packfile.c12
-rw-r--r--packfile.h2
-rw-r--r--sha1_file.c6
3 files changed, 10 insertions, 10 deletions
diff --git a/packfile.c b/packfile.c
index e65f943664..84acd405e0 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1805,7 +1805,7 @@ struct packed_git *find_sha1_pack(const unsigned char *sha1,
}
-static int fill_pack_entry(const unsigned char *sha1,
+static int fill_pack_entry(const struct object_id *oid,
struct pack_entry *e,
struct packed_git *p)
{
@@ -1814,11 +1814,11 @@ static int fill_pack_entry(const unsigned char *sha1,
if (p->num_bad_objects) {
unsigned i;
for (i = 0; i < p->num_bad_objects; i++)
- if (!hashcmp(sha1, p->bad_object_sha1 + 20 * i))
+ if (!hashcmp(oid->hash, p->bad_object_sha1 + 20 * i))
return 0;
}
- offset = find_pack_entry_one(sha1, p);
+ offset = find_pack_entry_one(oid->hash, p);
if (!offset)
return 0;
@@ -1836,7 +1836,7 @@ static int fill_pack_entry(const unsigned char *sha1,
return 1;
}
-int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack_entry *e)
+int find_pack_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e)
{
struct list_head *pos;
@@ -1846,7 +1846,7 @@ int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack
list_for_each(pos, &r->objects->packed_git_mru) {
struct packed_git *p = list_entry(pos, struct packed_git, mru);
- if (fill_pack_entry(sha1, e, p)) {
+ if (fill_pack_entry(oid, e, p)) {
list_move(&p->mru, &r->objects->packed_git_mru);
return 1;
}
@@ -1857,7 +1857,7 @@ int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack
int has_object_pack(const struct object_id *oid)
{
struct pack_entry e;
- return find_pack_entry(the_repository, oid->hash, &e);
+ return find_pack_entry(the_repository, oid, &e);
}
int has_pack_index(const unsigned char *sha1)
diff --git a/packfile.h b/packfile.h
index 14ca34bcbd..782029ed07 100644
--- a/packfile.h
+++ b/packfile.h
@@ -134,7 +134,7 @@ extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
* Iff a pack file in the given repository contains the object named by sha1,
* return true and store its location to e.
*/
-extern int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack_entry *e);
+extern int find_pack_entry(struct repository *r, const struct object_id *oid, struct pack_entry *e);
extern int has_object_pack(const struct object_id *oid);
diff --git a/sha1_file.c b/sha1_file.c
index 1617e25495..4328c61285 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1268,7 +1268,7 @@ int oid_object_info_extended(const struct object_id *oid, struct object_info *oi
}
while (1) {
- if (find_pack_entry(the_repository, real->hash, &e))
+ if (find_pack_entry(the_repository, real, &e))
break;
if (flags & OBJECT_INFO_IGNORE_LOOSE)
@@ -1281,7 +1281,7 @@ int oid_object_info_extended(const struct object_id *oid, struct object_info *oi
/* Not a loose object; someone else may have just packed it. */
if (!(flags & OBJECT_INFO_QUICK)) {
reprepare_packed_git(the_repository);
- if (find_pack_entry(the_repository, real->hash, &e))
+ if (find_pack_entry(the_repository, real, &e))
break;
}
@@ -1669,7 +1669,7 @@ static int freshen_loose_object(const struct object_id *oid)
static int freshen_packed_object(const struct object_id *oid)
{
struct pack_entry e;
- if (!find_pack_entry(the_repository, oid->hash, &e))
+ if (!find_pack_entry(the_repository, oid, &e))
return 0;
if (e.p->freshened)
return 1;