Skip to content

Commit 14c3c80

Browse files
bk2204gitster
authored andcommitted
packfile: convert has_sha1_pack to object_id
Convert this function to take a pointer to struct object_id and rename it has_object_pack for consistency with has_object_file. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c51c394 commit 14c3c80

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

builtin/count-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
6666
else {
6767
loose_size += on_disk_bytes(st);
6868
loose++;
69-
if (verbose && has_sha1_pack(oid->hash))
69+
if (verbose && has_object_pack(oid))
7070
packed_loose++;
7171
}
7272
return 0;

builtin/fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ static void check_reachable_object(struct object *obj)
227227
if (!(obj->flags & HAS_OBJ)) {
228228
if (is_promisor_object(&obj->oid))
229229
return;
230-
if (has_sha1_pack(obj->oid.hash))
230+
if (has_object_pack(&obj->oid))
231231
return; /* it is in pack - forget about it */
232232
printf("missing %s %s\n", printable_type(obj),
233233
describe_object(obj));

builtin/prune-packed.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static int prune_object(const struct object_id *oid, const char *path,
2525
{
2626
int *opts = data;
2727

28-
if (!has_sha1_pack(oid->hash))
28+
if (!has_object_pack(oid))
2929
return 0;
3030

3131
if (*opts & PRUNE_PACKED_DRY_RUN)

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3472,7 +3472,7 @@ static int reuse_worktree_file(const char *name, const struct object_id *oid, in
34723472
* objects however would tend to be slower as they need
34733473
* to be individually opened and inflated.
34743474
*/
3475-
if (!FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(oid->hash))
3475+
if (!FAST_WORKING_DIRECTORY && !want_file && has_object_pack(oid))
34763476
return 0;
34773477

34783478
/*

packfile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,10 +1854,10 @@ int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack
18541854
return 0;
18551855
}
18561856

1857-
int has_sha1_pack(const unsigned char *sha1)
1857+
int has_object_pack(const struct object_id *oid)
18581858
{
18591859
struct pack_entry e;
1860-
return find_pack_entry(the_repository, sha1, &e);
1860+
return find_pack_entry(the_repository, oid->hash, &e);
18611861
}
18621862

18631863
int has_pack_index(const unsigned char *sha1)

packfile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
136136
*/
137137
extern int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack_entry *e);
138138

139-
extern int has_sha1_pack(const unsigned char *sha1);
139+
extern int has_object_pack(const struct object_id *oid);
140140

141141
extern int has_pack_index(const unsigned char *sha1);
142142

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3086,7 +3086,7 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
30863086
{
30873087
if (commit->object.flags & SHOWN)
30883088
return commit_ignore;
3089-
if (revs->unpacked && has_sha1_pack(commit->object.oid.hash))
3089+
if (revs->unpacked && has_object_pack(&commit->object.oid))
30903090
return commit_ignore;
30913091
if (commit->object.flags & UNINTERESTING)
30923092
return commit_ignore;

0 commit comments

Comments
 (0)