summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2017-03-31 01:39:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-31 15:33:55 (GMT)
commit4ce3621a6dd3f98dab3c588b7f53f81b8404df32 (patch)
tree9f446e67e0e1de4b8b89c54eb8bf851a691d1128 /builtin/pack-objects.c
parent98a72ddc12e13231537150607f4a6a8ff8b43854 (diff)
downloadgit-4ce3621a6dd3f98dab3c588b7f53f81b8404df32.zip
git-4ce3621a6dd3f98dab3c588b7f53f81b8404df32.tar.gz
git-4ce3621a6dd3f98dab3c588b7f53f81b8404df32.tar.bz2
Convert remaining callers of sha1_array_lookup to object_id
There are a very small number of callers which don't already use struct object_id. Convert them. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index dfeacd5..dca1b68 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2670,14 +2670,14 @@ static int has_sha1_pack_kept_or_nonlocal(const unsigned char *sha1)
*/
static struct sha1_array recent_objects;
-static int loosened_object_can_be_discarded(const unsigned char *sha1,
+static int loosened_object_can_be_discarded(const struct object_id *oid,
unsigned long mtime)
{
if (!unpack_unreachable_expiration)
return 0;
if (mtime > unpack_unreachable_expiration)
return 0;
- if (sha1_array_lookup(&recent_objects, sha1) >= 0)
+ if (sha1_array_lookup(&recent_objects, oid->hash) >= 0)
return 0;
return 1;
}
@@ -2686,7 +2686,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
{
struct packed_git *p;
uint32_t i;
- const unsigned char *sha1;
+ struct object_id oid;
for (p = packed_git; p; p = p->next) {
if (!p->pack_local || p->pack_keep)
@@ -2696,11 +2696,11 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
die("cannot open pack index");
for (i = 0; i < p->num_objects; i++) {
- sha1 = nth_packed_object_sha1(p, i);
- if (!packlist_find(&to_pack, sha1, NULL) &&
- !has_sha1_pack_kept_or_nonlocal(sha1) &&
- !loosened_object_can_be_discarded(sha1, p->mtime))
- if (force_object_loose(sha1, p->mtime))
+ nth_packed_object_oid(&oid, p, i);
+ if (!packlist_find(&to_pack, oid.hash, NULL) &&
+ !has_sha1_pack_kept_or_nonlocal(oid.hash) &&
+ !loosened_object_can_be_discarded(&oid, p->mtime))
+ if (force_object_loose(oid.hash, p->mtime))
die("unable to force loose object");
}
}