refs/packed: stop using the_repository
Convert the packed ref backend to stop using `the_repository` in favor of the repo that gets passed in via `struct ref_store`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
a6ebc2c6d1
commit
79e54c6a4e
@@ -1,5 +1,3 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
|
||||
#include "../git-compat-util.h"
|
||||
#include "../config.h"
|
||||
#include "../dir.h"
|
||||
@@ -794,7 +792,7 @@ static int packed_read_raw_ref(struct ref_store *ref_store, const char *refname,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (get_oid_hex(rec, oid))
|
||||
if (get_oid_hex_algop(rec, oid, ref_store->repo->hash_algo))
|
||||
die_invalid_line(refs->path, rec, snapshot->eof - rec);
|
||||
|
||||
*type = REF_ISPACKED;
|
||||
@@ -879,7 +877,7 @@ static int next_record(struct packed_ref_iterator *iter)
|
||||
p = iter->pos;
|
||||
|
||||
if (iter->eof - p < snapshot_hexsz(iter->snapshot) + 2 ||
|
||||
parse_oid_hex(p, &iter->oid, &p) ||
|
||||
parse_oid_hex_algop(p, &iter->oid, &p, iter->repo->hash_algo) ||
|
||||
!isspace(*p++))
|
||||
die_invalid_line(iter->snapshot->refs->path,
|
||||
iter->pos, iter->eof - iter->pos);
|
||||
@@ -896,7 +894,7 @@ static int next_record(struct packed_ref_iterator *iter)
|
||||
if (!refname_is_safe(iter->base.refname))
|
||||
die("packed refname is dangerous: %s",
|
||||
iter->base.refname);
|
||||
oidclr(&iter->oid, the_repository->hash_algo);
|
||||
oidclr(&iter->oid, iter->repo->hash_algo);
|
||||
iter->base.flags |= REF_BAD_NAME | REF_ISBROKEN;
|
||||
}
|
||||
if (iter->snapshot->peeled == PEELED_FULLY ||
|
||||
@@ -909,7 +907,7 @@ static int next_record(struct packed_ref_iterator *iter)
|
||||
if (iter->pos < iter->eof && *iter->pos == '^') {
|
||||
p = iter->pos + 1;
|
||||
if (iter->eof - p < snapshot_hexsz(iter->snapshot) + 1 ||
|
||||
parse_oid_hex(p, &iter->peeled, &p) ||
|
||||
parse_oid_hex_algop(p, &iter->peeled, &p, iter->repo->hash_algo) ||
|
||||
*p++ != '\n')
|
||||
die_invalid_line(iter->snapshot->refs->path,
|
||||
iter->pos, iter->eof - iter->pos);
|
||||
@@ -921,13 +919,13 @@ static int next_record(struct packed_ref_iterator *iter)
|
||||
* we suppress it if the reference is broken:
|
||||
*/
|
||||
if ((iter->base.flags & REF_ISBROKEN)) {
|
||||
oidclr(&iter->peeled, the_repository->hash_algo);
|
||||
oidclr(&iter->peeled, iter->repo->hash_algo);
|
||||
iter->base.flags &= ~REF_KNOWS_PEELED;
|
||||
} else {
|
||||
iter->base.flags |= REF_KNOWS_PEELED;
|
||||
}
|
||||
} else {
|
||||
oidclr(&iter->peeled, the_repository->hash_algo);
|
||||
oidclr(&iter->peeled, iter->repo->hash_algo);
|
||||
}
|
||||
|
||||
return ITER_OK;
|
||||
|
||||
Reference in New Issue
Block a user