Skip to content

Commit 4020dff

Browse files
pks-tgitster
authored andcommitted
packfile: inline find_kept_pack_entry()
The `find_kept_pack_entry()` function is only used in `has_oject_kept_pack()`, which is only a trivial wrapper itself. Inline the latter into the former. Furthermore, reorder the code so that we can drop the declaration of the function in "packfile.h". This allow us to make the function file-local. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7bfa9a6 commit 4020dff

File tree

2 files changed

+10
-24
lines changed

2 files changed

+10
-24
lines changed

packfile.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,12 +2215,17 @@ struct packed_git **packfile_store_get_kept_pack_cache(struct packfile_store *st
22152215
return store->kept_cache.packs;
22162216
}
22172217

2218-
int find_kept_pack_entry(struct repository *r,
2219-
const struct object_id *oid,
2220-
unsigned flags,
2221-
struct pack_entry *e)
2218+
int has_object_pack(struct repository *r, const struct object_id *oid)
2219+
{
2220+
struct pack_entry e;
2221+
return find_pack_entry(r, oid, &e);
2222+
}
2223+
2224+
int has_object_kept_pack(struct repository *r, const struct object_id *oid,
2225+
unsigned flags)
22222226
{
22232227
struct odb_source *source;
2228+
struct pack_entry e;
22242229

22252230
for (source = r->objects->sources; source; source = source->next) {
22262231
struct packed_git **cache;
@@ -2229,27 +2234,14 @@ int find_kept_pack_entry(struct repository *r,
22292234

22302235
for (; *cache; cache++) {
22312236
struct packed_git *p = *cache;
2232-
if (fill_pack_entry(oid, e, p))
2237+
if (fill_pack_entry(oid, &e, p))
22332238
return 1;
22342239
}
22352240
}
22362241

22372242
return 0;
22382243
}
22392244

2240-
int has_object_pack(struct repository *r, const struct object_id *oid)
2241-
{
2242-
struct pack_entry e;
2243-
return find_pack_entry(r, oid, &e);
2244-
}
2245-
2246-
int has_object_kept_pack(struct repository *r, const struct object_id *oid,
2247-
unsigned flags)
2248-
{
2249-
struct pack_entry e;
2250-
return find_kept_pack_entry(r, oid, flags, &e);
2251-
}
2252-
22532245
int for_each_object_in_pack(struct packed_git *p,
22542246
each_packed_object_fn cb, void *data,
22552247
enum for_each_object_flags flags)

packfile.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,6 @@ int packed_object_info(struct repository *r,
444444
void mark_bad_packed_object(struct packed_git *, const struct object_id *);
445445
const struct packed_git *has_packed_and_bad(struct repository *, const struct object_id *);
446446

447-
/*
448-
* Iff a pack file in the given repository contains the object named by sha1,
449-
* return true and store its location to e.
450-
*/
451-
int find_kept_pack_entry(struct repository *r, const struct object_id *oid, unsigned flags, struct pack_entry *e);
452-
453447
int has_object_pack(struct repository *r, const struct object_id *oid);
454448
int has_object_kept_pack(struct repository *r, const struct object_id *oid,
455449
unsigned flags);

0 commit comments

Comments
 (0)