]> git.ipfire.org Git - thirdparty/git.git/commitdiff
packfile: convert has_sha1_pack to object_id
authorbrian m. carlson <sandals@crustytoothpaste.net>
Wed, 2 May 2018 00:25:33 +0000 (00:25 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 May 2018 04:59:49 +0000 (13:59 +0900)
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>
builtin/count-objects.c
builtin/fsck.c
builtin/prune-packed.c
diff.c
packfile.c
packfile.h
revision.c

index b054713e1a1e7d83563df0ec82d46dbca6bdb666..d51e2ce1ec016ab35f1781675ff70793f0b974d5 100644 (file)
@@ -66,7 +66,7 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
        else {
                loose_size += on_disk_bytes(st);
                loose++;
-               if (verbose && has_sha1_pack(oid->hash))
+               if (verbose && has_object_pack(oid))
                        packed_loose++;
        }
        return 0;
index 087360a6757c607c4b38cce5fafad3bbb0822fc0..3eb82ac44ffffd4665fa7ddb0b5b80420aa14ba2 100644 (file)
@@ -227,7 +227,7 @@ static void check_reachable_object(struct object *obj)
        if (!(obj->flags & HAS_OBJ)) {
                if (is_promisor_object(&obj->oid))
                        return;
-               if (has_sha1_pack(obj->oid.hash))
+               if (has_object_pack(&obj->oid))
                        return; /* it is in pack - forget about it */
                printf("missing %s %s\n", printable_type(obj),
                        describe_object(obj));
index 419238171d7a2159f5e533bab84408aacb4d35e4..4ff525e50fc701392e7ed276ae4bba4a82ddf8a1 100644 (file)
@@ -25,7 +25,7 @@ static int prune_object(const struct object_id *oid, const char *path,
 {
        int *opts = data;
 
-       if (!has_sha1_pack(oid->hash))
+       if (!has_object_pack(oid))
                return 0;
 
        if (*opts & PRUNE_PACKED_DRY_RUN)
diff --git a/diff.c b/diff.c
index 1289df4b1f9f395010e475073c2c5e5ce43976a7..314c57e3c0b981f8eeb5f7869009fead8fdb614e 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3472,7 +3472,7 @@ static int reuse_worktree_file(const char *name, const struct object_id *oid, in
         * objects however would tend to be slower as they need
         * to be individually opened and inflated.
         */
-       if (!FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(oid->hash))
+       if (!FAST_WORKING_DIRECTORY && !want_file && has_object_pack(oid))
                return 0;
 
        /*
index 5c219d0229f8a3faf9274201fd17463b288e084a..e65f94366452ff62bad13ea94903f569fbbc20ab 100644 (file)
@@ -1854,10 +1854,10 @@ int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack
        return 0;
 }
 
-int has_sha1_pack(const unsigned char *sha1)
+int has_object_pack(const struct object_id *oid)
 {
        struct pack_entry e;
-       return find_pack_entry(the_repository, sha1, &e);
+       return find_pack_entry(the_repository, oid->hash, &e);
 }
 
 int has_pack_index(const unsigned char *sha1)
index a92c0b241cfa65066ab57995f0f902ddb79a3be4..14ca34bcbd970fa645ee759de2ae35778037d595 100644 (file)
@@ -136,7 +136,7 @@ extern const struct packed_git *has_packed_and_bad(const unsigned char *sha1);
  */
 extern int find_pack_entry(struct repository *r, const unsigned char *sha1, struct pack_entry *e);
 
-extern int has_sha1_pack(const unsigned char *sha1);
+extern int has_object_pack(const struct object_id *oid);
 
 extern int has_pack_index(const unsigned char *sha1);
 
index b42c836d7a64a67779c587954bcab90d919aaffb..ce0e7b71f2b8d9035f863186c5519951a1049880 100644 (file)
@@ -3086,7 +3086,7 @@ enum commit_action get_commit_action(struct rev_info *revs, struct commit *commi
 {
        if (commit->object.flags & SHOWN)
                return commit_ignore;
-       if (revs->unpacked && has_sha1_pack(commit->object.oid.hash))
+       if (revs->unpacked && has_object_pack(&commit->object.oid))
                return commit_ignore;
        if (commit->object.flags & UNINTERESTING)
                return commit_ignore;