-#define USE_THE_REPOSITORY_VARIABLE
-
#include "git-compat-util.h"
#include "abspath.h"
#include "commit-graph.h"
string_list_insert(&odb->submodule_source_paths, path);
}
-static void fill_alternate_refs_command(struct child_process *cmd,
+static void fill_alternate_refs_command(struct repository *repo,
+ struct child_process *cmd,
const char *repo_path)
{
const char *value;
- if (!git_config_get_value("core.alternateRefsCommand", &value)) {
+ if (!repo_config_get_value(repo, "core.alternateRefsCommand", &value)) {
cmd->use_shell = 1;
strvec_push(&cmd->args, value);
strvec_push(&cmd->args, "for-each-ref");
strvec_push(&cmd->args, "--format=%(objectname)");
- if (!git_config_get_value("core.alternateRefsPrefixes", &value)) {
+ if (!repo_config_get_value(repo, "core.alternateRefsPrefixes", &value)) {
strvec_push(&cmd->args, "--");
strvec_split(&cmd->args, value);
}
cmd->out = -1;
}
-static void read_alternate_refs(const char *path,
+static void read_alternate_refs(struct repository *repo,
+ const char *path,
odb_for_each_alternate_ref_fn *cb,
void *payload)
{
struct strbuf line = STRBUF_INIT;
FILE *fh;
- fill_alternate_refs_command(&cmd, path);
+ fill_alternate_refs_command(repo, &cmd, path);
if (start_command(&cmd))
return;
struct object_id oid;
const char *p;
- if (parse_oid_hex(line.buf, &oid, &p) || *p) {
+ if (parse_oid_hex_algop(line.buf, &oid, &p, repo->hash_algo) || *p) {
warning(_("invalid line while parsing alternate refs: %s"),
line.buf);
break;
goto out;
strbuf_setlen(&path, base_len);
- read_alternate_refs(path.buf, cb->fn, cb->payload);
+ read_alternate_refs(alternate->odb->repo, path.buf, cb->fn, cb->payload);
out:
strbuf_release(&path);
if (oi->disk_sizep)
*(oi->disk_sizep) = 0;
if (oi->delta_base_oid)
- oidclr(oi->delta_base_oid, the_repository->hash_algo);
+ oidclr(oi->delta_base_oid, r->hash_algo);
if (oi->contentp)
*oi->contentp = xmemdupz(co->buf, co->size);
oi->whence = OI_CACHED;
void *content;
int ret;
- if (repo_oid_to_algop(r, input_oid, the_hash_algo, &oid)) {
+ if (repo_oid_to_algop(r, input_oid, r->hash_algo, &oid)) {
if (do_die)
die(_("missing mapping of %s to %s"),
- oid_to_hex(input_oid), the_hash_algo->name);
+ oid_to_hex(input_oid), r->hash_algo->name);
return -1;
}
struct strbuf outbuf = STRBUF_INIT;
if (type != OBJ_BLOB) {
- ret = convert_object_file(the_repository, &outbuf,
- the_hash_algo, input_algo,
+ ret = convert_object_file(r, &outbuf,
+ r->hash_algo, input_algo,
content, size, type, !do_die);
free(content);
if (ret == -1)
}
ref_length = strlen(ref_type);
- if (ref_length + the_hash_algo->hexsz > isize ||
+ if (ref_length + r->hash_algo->hexsz > isize ||
memcmp(buffer, ref_type, ref_length) ||
- get_oid_hex((char *) buffer + ref_length, &actual_oid)) {
+ get_oid_hex_algop((char *) buffer + ref_length, &actual_oid, r->hash_algo)) {
free(buffer);
return NULL;
}