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>

brian m. carlson committed May 2, 2018 at 00:25 UTC 14c3c80c81418e00ee990a88f526ac851411f422
7 files changed +8 -8
builtin/count-objects.c
+1 -1
@@ -66,7 +66,7 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
66 else {
67 loose_size += on_disk_bytes(st);
68 loose++;
69 - if (verbose && has_sha1_pack(oid->hash))
69 + if (verbose && has_object_pack(oid))
70 packed_loose++;
71 }
72 return 0;
builtin/fsck.c
+1 -1
@@ -227,7 +227,7 @@ static void check_reachable_object(struct object *obj)
227 if (!(obj->flags & HAS_OBJ)) {
228 if (is_promisor_object(&obj->oid))
229 return;
230 - if (has_sha1_pack(obj->oid.hash))
230 + if (has_object_pack(&obj->oid))
231 return; /* it is in pack - forget about it */
232 printf("missing %s %s\n", printable_type(obj),
233 describe_object(obj));
builtin/prune-packed.c
+1 -1
@@ -25,7 +25,7 @@ static int prune_object(const struct object_id *oid, const char *path,
25 {
26 int *opts = data;
27
28 - if (!has_sha1_pack(oid->hash))
28 + if (!has_object_pack(oid))
29 return 0;
30
31 if (*opts & PRUNE_PACKED_DRY_RUN)
diff.c
+1 -1
@@ -3472,7 +3472,7 @@ static int reuse_worktree_file(const char *name, const struct object_id *oid, in
3472 * objects however would tend to be slower as they need
3473 * to be individually opened and inflated.
3474 */
3475 - if (!FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(oid->hash))
3475 + if (!FAST_WORKING_DIRECTORY && !want_file && has_object_pack(oid))
3476 return 0;
3477
3478 /*
packfile.c
+2 -2
@@ -1854,10 +1854,10 @@ int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack
1854 return 0;
1855 }
1856
1857 -int has_sha1_pack(const unsigned char *sha1)
1857 +int has_object_pack(const struct object_id *oid)
1858 {
1859 struct pack_entry e;
1860 - return find_pack_entry(the_repository, sha1, &e);
1860 + return find_pack_entry(the_repository, oid->hash, &e);
1861 }
1862
1863 int has_pack_index(const unsigned char *sha1)
packfile.h
+1 -1
@@ -136,7 +136,7 @@ extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
136 */
137 extern int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack_entry *e);
138
139 -extern int has_sha1_pack(const unsigned char *sha1);
139 +extern int has_object_pack(const struct object_id *oid);
140
141 extern int has_pack_index(const unsigned char *sha1);
142
revision.c
+1 -1
@@ -3086,7 +3086,7 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
3086 {
3087 if (commit->object.flags & SHOWN)
3088 return commit_ignore;
3089 - if (revs->unpacked && has_sha1_pack(commit->object.oid.hash))
3089 + if (revs->unpacked && has_object_pack(&commit->object.oid))
3090 return commit_ignore;
3091 if (commit->object.flags & UNINTERESTING)
3092 return commit_ignore;