mirror of https://github.com/git/git.git
Merge branch 'ab/remove-implicit-use-of-the-repository' into en/header-split-cache-h
* ab/remove-implicit-use-of-the-repository: libs: use "struct repository *" argument, not "the_repository" post-cocci: adjust comments for recent repo_* migration cocci: apply the "revision.h" part of "the_repository.pending" cocci: apply the "rerere.h" part of "the_repository.pending" cocci: apply the "refs.h" part of "the_repository.pending" cocci: apply the "promisor-remote.h" part of "the_repository.pending" cocci: apply the "packfile.h" part of "the_repository.pending" cocci: apply the "pretty.h" part of "the_repository.pending" cocci: apply the "object-store.h" part of "the_repository.pending" cocci: apply the "diff.h" part of "the_repository.pending" cocci: apply the "commit.h" part of "the_repository.pending" cocci: apply the "commit-reach.h" part of "the_repository.pending" cocci: apply the "cache.h" part of "the_repository.pending" cocci: add missing "the_repository" macros to "pending" cocci: sort "the_repository" rules by header cocci: fix incorrect & verbose "the_repository" rules cocci: remove dead rule from "the_repository.pending.cocci"
This commit is contained in:
commit
e7dca80692
|
@ -553,7 +553,7 @@ static int get_modified_files(struct repository *r,
|
|||
opt.def = is_initial ?
|
||||
empty_tree_oid_hex() : oid_to_hex(&head_oid);
|
||||
|
||||
init_revisions(&rev, NULL);
|
||||
repo_init_revisions(r, &rev, NULL);
|
||||
setup_revisions(0, NULL, &rev, &opt);
|
||||
|
||||
rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
|
||||
|
|
|
@ -417,7 +417,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
|
|||
strvec_push(&args,
|
||||
/* could be on an unborn branch */
|
||||
!strcmp("HEAD", s->revision) &&
|
||||
get_oid("HEAD", &oid) ?
|
||||
repo_get_oid(the_repository, "HEAD", &oid) ?
|
||||
empty_tree_oid_hex() : s->revision);
|
||||
}
|
||||
color_arg_index = args.nr;
|
||||
|
|
13
apply.c
13
apply.c
|
@ -3208,7 +3208,8 @@ static int apply_binary(struct apply_state *state,
|
|||
unsigned long size;
|
||||
char *result;
|
||||
|
||||
result = read_object_file(&oid, &type, &size);
|
||||
result = repo_read_object_file(the_repository, &oid, &type,
|
||||
&size);
|
||||
if (!result)
|
||||
return error(_("the necessary postimage %s for "
|
||||
"'%s' cannot be read"),
|
||||
|
@ -3271,7 +3272,8 @@ static int read_blob_object(struct strbuf *buf, const struct object_id *oid, uns
|
|||
unsigned long sz;
|
||||
char *result;
|
||||
|
||||
result = read_object_file(oid, &type, &sz);
|
||||
result = repo_read_object_file(the_repository, oid, &type,
|
||||
&sz);
|
||||
if (!result)
|
||||
return -1;
|
||||
/* XXX read_sha1_file NUL-terminates */
|
||||
|
@ -3499,7 +3501,8 @@ static int resolve_to(struct image *image, const struct object_id *result_id)
|
|||
|
||||
clear_image(image);
|
||||
|
||||
image->buf = read_object_file(result_id, &type, &size);
|
||||
image->buf = repo_read_object_file(the_repository, result_id, &type,
|
||||
&size);
|
||||
if (!image->buf || type != OBJ_BLOB)
|
||||
die("unable to read blob object %s", oid_to_hex(result_id));
|
||||
image->len = size;
|
||||
|
@ -3617,7 +3620,7 @@ static int try_threeway(struct apply_state *state,
|
|||
/* Preimage the patch was prepared for */
|
||||
if (patch->is_new)
|
||||
write_object_file("", 0, OBJ_BLOB, &pre_oid);
|
||||
else if (get_oid(patch->old_oid_prefix, &pre_oid) ||
|
||||
else if (repo_get_oid(the_repository, patch->old_oid_prefix, &pre_oid) ||
|
||||
read_blob_object(&buf, &pre_oid, patch->old_mode))
|
||||
return error(_("repository lacks the necessary blob to perform 3-way merge."));
|
||||
|
||||
|
@ -4134,7 +4137,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
|
|||
else
|
||||
return error(_("sha1 information is lacking or "
|
||||
"useless for submodule %s"), name);
|
||||
} else if (!get_oid_blob(patch->old_oid_prefix, &oid)) {
|
||||
} else if (!repo_get_oid_blob(the_repository, patch->old_oid_prefix, &oid)) {
|
||||
; /* ok */
|
||||
} else if (!patch->lines_added && !patch->lines_deleted) {
|
||||
/* mode-only change: update the current */
|
||||
|
|
12
archive.c
12
archive.c
|
@ -65,7 +65,8 @@ static void format_subst(const struct commit *commit,
|
|||
strbuf_add(&fmt, b + 8, c - b - 8);
|
||||
|
||||
strbuf_add(buf, src, b - src);
|
||||
format_commit_message(commit, fmt.buf, buf, ctx);
|
||||
repo_format_commit_message(the_repository, commit, fmt.buf,
|
||||
buf, ctx);
|
||||
len -= c + 1 - src;
|
||||
src = c + 1;
|
||||
}
|
||||
|
@ -90,7 +91,7 @@ static void *object_file_to_archive(const struct archiver_args *args,
|
|||
(args->tree ? &args->tree->object.oid : NULL), oid);
|
||||
|
||||
path += args->baselen;
|
||||
buffer = read_object_file(oid, type, sizep);
|
||||
buffer = repo_read_object_file(the_repository, oid, type, sizep);
|
||||
if (buffer && S_ISREG(mode)) {
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
size_t size = 0;
|
||||
|
@ -461,13 +462,14 @@ static void parse_treeish_arg(const char **argv,
|
|||
const char *colon = strchrnul(name, ':');
|
||||
int refnamelen = colon - name;
|
||||
|
||||
if (!dwim_ref(name, refnamelen, &oid, &ref, 0))
|
||||
if (!repo_dwim_ref(the_repository, name, refnamelen, &oid, &ref, 0))
|
||||
die(_("no such ref: %.*s"), refnamelen, name);
|
||||
} else {
|
||||
dwim_ref(name, strlen(name), &oid, &ref, 0);
|
||||
repo_dwim_ref(the_repository, name, strlen(name), &oid, &ref,
|
||||
0);
|
||||
}
|
||||
|
||||
if (get_oid(name, &oid))
|
||||
if (repo_get_oid(the_repository, name, &oid))
|
||||
die(_("not a valid object name: %s"), name);
|
||||
|
||||
commit = lookup_commit_reference_gently(ar_args->repo, &oid, 1);
|
||||
|
|
11
bisect.c
11
bisect.c
|
@ -151,8 +151,9 @@ static void show_list(const char *debug, int counted, int nr,
|
|||
unsigned commit_flags = commit->object.flags;
|
||||
enum object_type type;
|
||||
unsigned long size;
|
||||
char *buf = read_object_file(&commit->object.oid, &type,
|
||||
&size);
|
||||
char *buf = repo_read_object_file(the_repository,
|
||||
&commit->object.oid, &type,
|
||||
&size);
|
||||
const char *subject_start;
|
||||
int subject_len;
|
||||
|
||||
|
@ -754,7 +755,8 @@ enum bisect_error bisect_checkout(const struct object_id *bisect_rev,
|
|||
}
|
||||
|
||||
commit = lookup_commit_reference(the_repository, bisect_rev);
|
||||
format_commit_message(commit, "[%H] %s%n", &commit_msg, &pp);
|
||||
repo_format_commit_message(the_repository, commit, "[%H] %s%n",
|
||||
&commit_msg, &pp);
|
||||
fputs(commit_msg.buf, stdout);
|
||||
strbuf_release(&commit_msg);
|
||||
|
||||
|
@ -849,7 +851,8 @@ static enum bisect_error check_merge_bases(int rev_nr, struct commit **rev, int
|
|||
enum bisect_error res = BISECT_OK;
|
||||
struct commit_list *result;
|
||||
|
||||
result = get_merge_bases_many(rev[0], rev_nr - 1, rev + 1);
|
||||
result = repo_get_merge_bases_many(the_repository, rev[0], rev_nr - 1,
|
||||
rev + 1);
|
||||
|
||||
for (; result; result = result->next) {
|
||||
const struct object_id *mb = &result->item->object.oid;
|
||||
|
|
15
blame.c
15
blame.c
|
@ -1031,8 +1031,9 @@ static void fill_origin_blob(struct diff_options *opt,
|
|||
&o->blob_oid, 1, &file->ptr, &file_size))
|
||||
;
|
||||
else
|
||||
file->ptr = read_object_file(&o->blob_oid, &type,
|
||||
&file_size);
|
||||
file->ptr = repo_read_object_file(the_repository,
|
||||
&o->blob_oid, &type,
|
||||
&file_size);
|
||||
file->size = file_size;
|
||||
|
||||
if (!file->ptr)
|
||||
|
@ -2432,7 +2433,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
|
|||
|
||||
if (sg_origin[i])
|
||||
continue;
|
||||
if (parse_commit(p))
|
||||
if (repo_parse_commit(the_repository, p))
|
||||
continue;
|
||||
porigin = find(sb->repo, p, origin, sb->bloom_data);
|
||||
if (!porigin)
|
||||
|
@ -2595,7 +2596,7 @@ void assign_blame(struct blame_scoreboard *sb, int opt)
|
|||
* so hold onto it in the meantime.
|
||||
*/
|
||||
blame_origin_incref(suspect);
|
||||
parse_commit(commit);
|
||||
repo_parse_commit(the_repository, commit);
|
||||
if (sb->reverse ||
|
||||
(!(commit->object.flags & UNINTERESTING) &&
|
||||
!(revs->max_age != -1 && commit->date < revs->max_age)))
|
||||
|
@ -2841,8 +2842,10 @@ void setup_scoreboard(struct blame_scoreboard *sb,
|
|||
&sb->final_buf_size))
|
||||
;
|
||||
else
|
||||
sb->final_buf = read_object_file(&o->blob_oid, &type,
|
||||
&sb->final_buf_size);
|
||||
sb->final_buf = repo_read_object_file(the_repository,
|
||||
&o->blob_oid,
|
||||
&type,
|
||||
&sb->final_buf_size);
|
||||
|
||||
if (!sb->final_buf)
|
||||
die(_("cannot read blob %s for path %s"),
|
||||
|
|
7
branch.c
7
branch.c
|
@ -534,7 +534,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
|
|||
explicit_tracking = 1;
|
||||
|
||||
real_ref = NULL;
|
||||
if (get_oid_mb(start_name, &oid)) {
|
||||
if (repo_get_oid_mb(r, start_name, &oid)) {
|
||||
if (explicit_tracking) {
|
||||
int code = die_message(_(upstream_missing), start_name);
|
||||
advise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE,
|
||||
|
@ -544,7 +544,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name,
|
|||
die(_("not a valid object name: '%s'"), start_name);
|
||||
}
|
||||
|
||||
switch (dwim_ref(start_name, strlen(start_name), &oid, &real_ref, 0)) {
|
||||
switch (repo_dwim_ref(r, start_name, strlen(start_name), &oid,
|
||||
&real_ref, 0)) {
|
||||
case 0:
|
||||
/* Not branching from any existing branch */
|
||||
if (explicit_tracking)
|
||||
|
@ -775,7 +776,7 @@ void create_branches_recursively(struct repository *r, const char *name,
|
|||
name);
|
||||
}
|
||||
|
||||
create_branch(the_repository, name, start_commitish, force, 0, reflog, quiet,
|
||||
create_branch(r, name, start_commitish, force, 0, reflog, quiet,
|
||||
BRANCH_TRACK_NEVER, dry_run);
|
||||
if (dry_run)
|
||||
return;
|
||||
|
|
23
builtin/am.c
23
builtin/am.c
|
@ -1071,7 +1071,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
|
|||
else
|
||||
write_state_text(state, "applying", "");
|
||||
|
||||
if (!get_oid("HEAD", &curr_head)) {
|
||||
if (!repo_get_oid(the_repository, "HEAD", &curr_head)) {
|
||||
write_state_text(state, "abort-safety", oid_to_hex(&curr_head));
|
||||
if (!state->rebasing)
|
||||
update_ref("am", "ORIG_HEAD", &curr_head, NULL, 0,
|
||||
|
@ -1114,7 +1114,7 @@ static void am_next(struct am_state *state)
|
|||
unlink(am_path(state, "original-commit"));
|
||||
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
|
||||
|
||||
if (!get_oid("HEAD", &head))
|
||||
if (!repo_get_oid(the_repository, "HEAD", &head))
|
||||
write_state_text(state, "abort-safety", oid_to_hex(&head));
|
||||
else
|
||||
write_state_text(state, "abort-safety", "");
|
||||
|
@ -1334,7 +1334,8 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
|
|||
size_t ident_len;
|
||||
struct ident_split id;
|
||||
|
||||
buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding());
|
||||
buffer = repo_logmsg_reencode(the_repository, commit, NULL,
|
||||
get_commit_output_encoding());
|
||||
|
||||
ident_line = find_commit_header(buffer, "author", &ident_len);
|
||||
if (!ident_line)
|
||||
|
@ -1366,7 +1367,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit)
|
|||
die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid));
|
||||
state->msg = xstrdup(msg + 2);
|
||||
state->msg_len = strlen(state->msg);
|
||||
unuse_commit_buffer(commit, buffer);
|
||||
repo_unuse_commit_buffer(the_repository, commit, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1407,9 +1408,9 @@ static void write_index_patch(const struct am_state *state)
|
|||
struct rev_info rev_info;
|
||||
FILE *fp;
|
||||
|
||||
if (!get_oid("HEAD", &head)) {
|
||||
if (!repo_get_oid(the_repository, "HEAD", &head)) {
|
||||
struct commit *commit = lookup_commit_or_die(&head, "HEAD");
|
||||
tree = get_commit_tree(commit);
|
||||
tree = repo_get_commit_tree(the_repository, commit);
|
||||
} else
|
||||
tree = lookup_tree(the_repository,
|
||||
the_repository->hash_algo->empty_tree);
|
||||
|
@ -1561,7 +1562,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
|
|||
struct commit *result;
|
||||
char *their_tree_name;
|
||||
|
||||
if (get_oid("HEAD", &our_tree) < 0)
|
||||
if (repo_get_oid(the_repository, "HEAD", &our_tree) < 0)
|
||||
oidcpy(&our_tree, the_hash_algo->empty_tree);
|
||||
|
||||
if (build_fake_ancestor(state, index_path))
|
||||
|
@ -1651,7 +1652,7 @@ static void do_commit(const struct am_state *state)
|
|||
if (write_index_as_tree(&tree, &the_index, get_index_file(), 0, NULL))
|
||||
die(_("git write-tree failed to write a tree"));
|
||||
|
||||
if (!get_oid_commit("HEAD", &parent)) {
|
||||
if (!repo_get_oid_commit(the_repository, "HEAD", &parent)) {
|
||||
old_oid = &parent;
|
||||
commit_list_insert(lookup_commit(the_repository, &parent),
|
||||
&parents);
|
||||
|
@ -2093,7 +2094,7 @@ static void am_skip(struct am_state *state)
|
|||
|
||||
am_rerere_clear();
|
||||
|
||||
if (get_oid("HEAD", &head))
|
||||
if (repo_get_oid(the_repository, "HEAD", &head))
|
||||
oidcpy(&head, the_hash_algo->empty_tree);
|
||||
|
||||
if (clean_index(&head, &head))
|
||||
|
@ -2135,7 +2136,7 @@ static int safe_to_abort(const struct am_state *state)
|
|||
oidclr(&abort_safety);
|
||||
strbuf_release(&sb);
|
||||
|
||||
if (get_oid("HEAD", &head))
|
||||
if (repo_get_oid(the_repository, "HEAD", &head))
|
||||
oidclr(&head);
|
||||
|
||||
if (oideq(&head, &abort_safety))
|
||||
|
@ -2168,7 +2169,7 @@ static void am_abort(struct am_state *state)
|
|||
if (!has_curr_head)
|
||||
oidcpy(&curr_head, the_hash_algo->empty_tree);
|
||||
|
||||
has_orig_head = !get_oid("ORIG_HEAD", &orig_head);
|
||||
has_orig_head = !repo_get_oid(the_repository, "ORIG_HEAD", &orig_head);
|
||||
if (!has_orig_head)
|
||||
oidcpy(&orig_head, the_hash_algo->empty_tree);
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ static int bisect_reset(const char *commit)
|
|||
} else {
|
||||
struct object_id oid;
|
||||
|
||||
if (get_oid_commit(commit, &oid))
|
||||
if (repo_get_oid_commit(the_repository, commit, &oid))
|
||||
return error(_("'%s' is not a valid commit"), commit);
|
||||
strbuf_addstr(&branch, commit);
|
||||
}
|
||||
|
@ -270,7 +270,8 @@ static void log_commit(FILE *fp, char *fmt, const char *state,
|
|||
struct strbuf commit_msg = STRBUF_INIT;
|
||||
char *label = xstrfmt(fmt, state);
|
||||
|
||||
format_commit_message(commit, "%s", &commit_msg, &pp);
|
||||
repo_format_commit_message(the_repository, commit, "%s", &commit_msg,
|
||||
&pp);
|
||||
|
||||
fprintf(fp, "# %s: [%s] %s\n", label, oid_to_hex(&commit->object.oid),
|
||||
commit_msg.buf);
|
||||
|
@ -297,7 +298,7 @@ static int bisect_write(const char *state, const char *rev,
|
|||
goto finish;
|
||||
}
|
||||
|
||||
if (get_oid(rev, &oid)) {
|
||||
if (repo_get_oid(the_repository, rev, &oid)) {
|
||||
res = error(_("couldn't get the oid of the rev '%s'"), rev);
|
||||
goto finish;
|
||||
}
|
||||
|
@ -572,7 +573,7 @@ static int prepare_revs(struct bisect_terms *terms, struct rev_info *revs)
|
|||
* sets up a revision walk.
|
||||
*/
|
||||
reset_revision_walk();
|
||||
init_revisions(revs, NULL);
|
||||
repo_init_revisions(the_repository, revs, NULL);
|
||||
setup_revisions(0, NULL, revs, NULL);
|
||||
for_each_glob_ref_in(add_bisect_ref, bad, "refs/bisect/", &cb);
|
||||
cb.object_flags = UNINTERESTING;
|
||||
|
@ -608,8 +609,8 @@ static int bisect_skipped_commits(struct bisect_terms *terms)
|
|||
|
||||
while ((commit = get_revision(&revs)) != NULL) {
|
||||
strbuf_reset(&commit_name);
|
||||
format_commit_message(commit, "%s",
|
||||
&commit_name, &pp);
|
||||
repo_format_commit_message(the_repository, commit, "%s",
|
||||
&commit_name, &pp);
|
||||
fprintf(fp, "# possible first %s commit: [%s] %s\n",
|
||||
terms->term_bad, oid_to_hex(&commit->object.oid),
|
||||
commit_name.buf);
|
||||
|
@ -638,7 +639,8 @@ static int bisect_successful(struct bisect_terms *terms)
|
|||
|
||||
read_ref(bad_ref, &oid);
|
||||
commit = lookup_commit_reference_by_name(bad_ref);
|
||||
format_commit_message(commit, "%s", &commit_name, &pp);
|
||||
repo_format_commit_message(the_repository, commit, "%s", &commit_name,
|
||||
&pp);
|
||||
|
||||
res = append_to_file(git_path_bisect_log(), "# first %s commit: [%s] %s\n",
|
||||
terms->term_bad, oid_to_hex(&commit->object.oid),
|
||||
|
@ -780,7 +782,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
|
|||
*/
|
||||
head = resolve_ref_unsafe("HEAD", 0, &head_oid, &flags);
|
||||
if (!head)
|
||||
if (get_oid("HEAD", &head_oid))
|
||||
if (repo_get_oid(the_repository, "HEAD", &head_oid))
|
||||
return error(_("bad HEAD - I need a HEAD"));
|
||||
|
||||
/*
|
||||
|
@ -806,11 +808,11 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
|
|||
}
|
||||
} else {
|
||||
/* Get the rev from where we start. */
|
||||
if (!get_oid(head, &head_oid) &&
|
||||
if (!repo_get_oid(the_repository, head, &head_oid) &&
|
||||
!starts_with(head, "refs/heads/")) {
|
||||
strbuf_reset(&start_head);
|
||||
strbuf_addstr(&start_head, oid_to_hex(&head_oid));
|
||||
} else if (!get_oid(head, &head_oid) &&
|
||||
} else if (!repo_get_oid(the_repository, head, &head_oid) &&
|
||||
skip_prefix(head, "refs/heads/", &head)) {
|
||||
strbuf_addstr(&start_head, head);
|
||||
} else {
|
||||
|
@ -833,7 +835,7 @@ static enum bisect_error bisect_start(struct bisect_terms *terms, int argc,
|
|||
write_file(git_path_bisect_first_parent(), "\n");
|
||||
|
||||
if (no_checkout) {
|
||||
if (get_oid(start_head.buf, &oid) < 0) {
|
||||
if (repo_get_oid(the_repository, start_head.buf, &oid) < 0) {
|
||||
res = error(_("invalid ref: '%s'"), start_head.buf);
|
||||
goto finish;
|
||||
}
|
||||
|
@ -938,11 +940,12 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
|
|||
|
||||
if (argc == 0) {
|
||||
const char *head = "BISECT_HEAD";
|
||||
enum get_oid_result res_head = get_oid(head, &oid);
|
||||
enum get_oid_result res_head = repo_get_oid(the_repository,
|
||||
head, &oid);
|
||||
|
||||
if (res_head == MISSING_OBJECT) {
|
||||
head = "HEAD";
|
||||
res_head = get_oid(head, &oid);
|
||||
res_head = repo_get_oid(the_repository, head, &oid);
|
||||
}
|
||||
|
||||
if (res_head)
|
||||
|
@ -958,7 +961,7 @@ static enum bisect_error bisect_state(struct bisect_terms *terms, int argc,
|
|||
for (; argc; argc--, argv++) {
|
||||
struct commit *commit;
|
||||
|
||||
if (get_oid(*argv, &oid)){
|
||||
if (repo_get_oid(the_repository, *argv, &oid)){
|
||||
error(_("Bad rev input: %s"), *argv);
|
||||
oid_array_clear(&revs);
|
||||
return BISECT_FAILED;
|
||||
|
@ -1097,7 +1100,7 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, int argc,
|
|||
struct rev_info revs;
|
||||
struct commit *commit;
|
||||
|
||||
init_revisions(&revs, NULL);
|
||||
repo_init_revisions(the_repository, &revs, NULL);
|
||||
setup_revisions(2, argv + i - 1, &revs, NULL);
|
||||
|
||||
if (prepare_revision_walk(&revs))
|
||||
|
|
|
@ -205,13 +205,13 @@ static void get_commit_info(struct commit *commit,
|
|||
const char *message;
|
||||
|
||||
encoding = get_log_output_encoding();
|
||||
message = logmsg_reencode(commit, NULL, encoding);
|
||||
message = repo_logmsg_reencode(the_repository, commit, NULL, encoding);
|
||||
get_ac_line(message, "\nauthor ",
|
||||
&ret->author, &ret->author_mail,
|
||||
&ret->author_time, &ret->author_tz);
|
||||
|
||||
if (!detailed) {
|
||||
unuse_commit_buffer(commit, message);
|
||||
repo_unuse_commit_buffer(the_repository, commit, message);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ static void get_commit_info(struct commit *commit,
|
|||
else
|
||||
strbuf_addf(&ret->summary, "(%s)", oid_to_hex(&commit->object.oid));
|
||||
|
||||
unuse_commit_buffer(commit, message);
|
||||
repo_unuse_commit_buffer(the_repository, commit, message);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -607,8 +607,9 @@ static int read_ancestry(const char *graft_file)
|
|||
|
||||
static int update_auto_abbrev(int auto_abbrev, struct blame_origin *suspect)
|
||||
{
|
||||
const char *uniq = find_unique_abbrev(&suspect->commit->object.oid,
|
||||
auto_abbrev);
|
||||
const char *uniq = repo_find_unique_abbrev(the_repository,
|
||||
&suspect->commit->object.oid,
|
||||
auto_abbrev);
|
||||
int len = strlen(uniq);
|
||||
if (auto_abbrev < len)
|
||||
return len;
|
||||
|
@ -808,7 +809,7 @@ static int is_a_rev(const char *name)
|
|||
{
|
||||
struct object_id oid;
|
||||
|
||||
if (get_oid(name, &oid))
|
||||
if (repo_get_oid(the_repository, name, &oid))
|
||||
return 0;
|
||||
return OBJ_NONE < oid_object_info(the_repository, &oid, NULL);
|
||||
}
|
||||
|
@ -851,7 +852,7 @@ static void build_ignorelist(struct blame_scoreboard *sb,
|
|||
peel_to_commit_oid, sb);
|
||||
}
|
||||
for_each_string_list_item(i, ignore_rev_list) {
|
||||
if (get_oid_committish(i->string, &oid) ||
|
||||
if (repo_get_oid_committish(the_repository, i->string, &oid) ||
|
||||
peel_to_commit_oid(&oid, sb))
|
||||
die(_("cannot find revision %s to ignore"), i->string);
|
||||
oidset_insert(&sb->ignore_list, &oid);
|
||||
|
|
|
@ -153,17 +153,18 @@ static int branch_merged(int kind, const char *name,
|
|||
if (!reference_rev)
|
||||
reference_rev = head_rev;
|
||||
|
||||
merged = reference_rev ? in_merge_bases(rev, reference_rev) : 0;
|
||||
merged = reference_rev ? repo_in_merge_bases(the_repository, rev,
|
||||
reference_rev) : 0;
|
||||
|
||||
/*
|
||||
* After the safety valve is fully redefined to "check with
|
||||
* upstream, if any, otherwise with HEAD", we should just
|
||||
* return the result of the in_merge_bases() above without
|
||||
* return the result of the repo_in_merge_bases() above without
|
||||
* any of the following code, but during the transition period,
|
||||
* a gentle reminder is in order.
|
||||
*/
|
||||
if ((head_rev != reference_rev) &&
|
||||
(head_rev ? in_merge_bases(rev, head_rev) : 0) != merged) {
|
||||
(head_rev ? repo_in_merge_bases(the_repository, rev, head_rev) : 0) != merged) {
|
||||
if (merged)
|
||||
warning(_("deleting branch '%s' that has been merged to\n"
|
||||
" '%s', but not yet merged to HEAD."),
|
||||
|
@ -283,7 +284,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
|
|||
item = string_list_append(&refs_to_delete, name);
|
||||
item->util = xstrdup((flags & REF_ISBROKEN) ? "broken"
|
||||
: (flags & REF_ISSYMREF) ? target
|
||||
: find_unique_abbrev(&oid, DEFAULT_ABBREV));
|
||||
: repo_find_unique_abbrev(the_repository, &oid, DEFAULT_ABBREV));
|
||||
|
||||
next:
|
||||
free(target);
|
||||
|
|
|
@ -67,7 +67,7 @@ static int filter_object(const char *path, unsigned mode,
|
|||
{
|
||||
enum object_type type;
|
||||
|
||||
*buf = read_object_file(oid, &type, size);
|
||||
*buf = repo_read_object_file(the_repository, oid, &type, size);
|
||||
if (!*buf)
|
||||
return error(_("cannot read object %s '%s'"),
|
||||
oid_to_hex(oid), path);
|
||||
|
@ -159,7 +159,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
|
|||
goto cleanup;
|
||||
|
||||
case 'e':
|
||||
return !has_object_file(&oid);
|
||||
return !repo_has_object_file(the_repository, &oid);
|
||||
|
||||
case 'w':
|
||||
|
||||
|
@ -194,7 +194,8 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
|
|||
ret = stream_blob(&oid);
|
||||
goto cleanup;
|
||||
}
|
||||
buf = read_object_file(&oid, &type, &size);
|
||||
buf = repo_read_object_file(the_repository, &oid, &type,
|
||||
&size);
|
||||
if (!buf)
|
||||
die("Cannot read object %s", obj_name);
|
||||
|
||||
|
@ -214,8 +215,10 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name,
|
|||
if (exp_type_id == OBJ_BLOB) {
|
||||
struct object_id blob_oid;
|
||||
if (oid_object_info(the_repository, &oid, NULL) == OBJ_TAG) {
|
||||
char *buffer = read_object_file(&oid, &type,
|
||||
&size);
|
||||
char *buffer = repo_read_object_file(the_repository,
|
||||
&oid,
|
||||
&type,
|
||||
&size);
|
||||
const char *target;
|
||||
if (!skip_prefix(buffer, "object ", &target) ||
|
||||
get_oid_hex(target, &blob_oid))
|
||||
|
@ -390,9 +393,10 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
|
|||
if (!textconv_object(the_repository,
|
||||
data->rest, 0100644, oid,
|
||||
1, &contents, &size))
|
||||
contents = read_object_file(oid,
|
||||
&type,
|
||||
&size);
|
||||
contents = repo_read_object_file(the_repository,
|
||||
oid,
|
||||
&type,
|
||||
&size);
|
||||
if (!contents)
|
||||
die("could not convert '%s' %s",
|
||||
oid_to_hex(oid), data->rest);
|
||||
|
@ -409,7 +413,8 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
|
|||
unsigned long size;
|
||||
void *contents;
|
||||
|
||||
contents = read_object_file(oid, &type, &size);
|
||||
contents = repo_read_object_file(the_repository, oid, &type,
|
||||
&size);
|
||||
|
||||
if (use_mailmap) {
|
||||
size_t s = size;
|
||||
|
@ -794,7 +799,7 @@ static int batch_objects(struct batch_options *opt)
|
|||
if (!memcmp(&data.info, &empty, sizeof(empty)))
|
||||
data.skip_object_info = 1;
|
||||
|
||||
if (has_promisor_remote())
|
||||
if (repo_has_promisor_remote(the_repository))
|
||||
warning("This repository uses promisor remotes. Some objects may not be loaded.");
|
||||
|
||||
read_replace_refs = 0;
|
||||
|
|
|
@ -436,8 +436,8 @@ static int checkout_worktree(const struct checkout_opts *opts,
|
|||
"Updated %d paths from %s",
|
||||
nr_checkouts),
|
||||
nr_checkouts,
|
||||
find_unique_abbrev(&opts->source_tree->object.oid,
|
||||
DEFAULT_ABBREV));
|
||||
repo_find_unique_abbrev(the_repository, &opts->source_tree->object.oid,
|
||||
DEFAULT_ABBREV));
|
||||
else if (!nr_unmerged || nr_checkouts)
|
||||
fprintf_ln(stderr, Q_("Updated %d path from the index",
|
||||
"Updated %d paths from the index",
|
||||
|
@ -657,14 +657,16 @@ static void describe_detached_head(const char *msg, struct commit *commit)
|
|||
{
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
if (!parse_commit(commit))
|
||||
if (!repo_parse_commit(the_repository, commit))
|
||||
pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb);
|
||||
if (print_sha1_ellipsis()) {
|
||||
fprintf(stderr, "%s %s... %s\n", msg,
|
||||
find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), sb.buf);
|
||||
repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),
|
||||
sb.buf);
|
||||
} else {
|
||||
fprintf(stderr, "%s %s %s\n", msg,
|
||||
find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV), sb.buf);
|
||||
repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV),
|
||||
sb.buf);
|
||||
}
|
||||
strbuf_release(&sb);
|
||||
}
|
||||
|
@ -718,7 +720,8 @@ static void setup_branch_path(struct branch_info *branch)
|
|||
* If this is a ref, resolve it; otherwise, look up the OID for our
|
||||
* expression. Failure here is okay.
|
||||
*/
|
||||
if (!dwim_ref(branch->name, strlen(branch->name), &branch->oid, &branch->refname, 0))
|
||||
if (!repo_dwim_ref(the_repository, branch->name, strlen(branch->name),
|
||||
&branch->oid, &branch->refname, 0))
|
||||
repo_get_oid_committish(the_repository, branch->name, &branch->oid);
|
||||
|
||||
strbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);
|
||||
|
@ -770,7 +773,8 @@ static int merge_working_tree(const struct checkout_opts *opts,
|
|||
BUG("'switch --orphan' should never accept a commit as starting point");
|
||||
new_tree = parse_tree_indirect(the_hash_algo->empty_tree);
|
||||
} else
|
||||
new_tree = get_commit_tree(new_branch_info->commit);
|
||||
new_tree = repo_get_commit_tree(the_repository,
|
||||
new_branch_info->commit);
|
||||
if (opts->discard_changes) {
|
||||
ret = reset_tree(new_tree, opts, 1, writeout_error, new_branch_info);
|
||||
if (ret)
|
||||
|
@ -832,7 +836,8 @@ static int merge_working_tree(const struct checkout_opts *opts,
|
|||
*/
|
||||
if (!old_branch_info->commit)
|
||||
return 1;
|
||||
old_tree = get_commit_tree(old_branch_info->commit);
|
||||
old_tree = repo_get_commit_tree(the_repository,
|
||||
old_branch_info->commit);
|
||||
|
||||
if (repo_index_has_changes(the_repository, old_tree, &sb))
|
||||
die(_("cannot continue with staged changes in "
|
||||
|
@ -1021,7 +1026,7 @@ static void describe_one_orphan(struct strbuf *sb, struct commit *commit)
|
|||
strbuf_addstr(sb, " ");
|
||||
strbuf_add_unique_abbrev(sb, &commit->object.oid, DEFAULT_ABBREV);
|
||||
strbuf_addch(sb, ' ');
|
||||
if (!parse_commit(commit))
|
||||
if (!repo_parse_commit(the_repository, commit))
|
||||
pp_commit_easy(CMIT_FMT_ONELINE, commit, sb);
|
||||
strbuf_addch(sb, '\n');
|
||||
}
|
||||
|
@ -1077,7 +1082,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
|
|||
" git branch <new-branch-name> %s\n\n",
|
||||
/* Give ngettext() the count */
|
||||
lost),
|
||||
find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV));
|
||||
repo_find_unique_abbrev(the_repository, &commit->object.oid, DEFAULT_ABBREV));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1221,7 +1226,8 @@ static void setup_new_branch_info_and_source_tree(
|
|||
*source_tree = parse_tree_indirect(rev);
|
||||
} else {
|
||||
parse_commit_or_die(new_branch_info->commit);
|
||||
*source_tree = get_commit_tree(new_branch_info->commit);
|
||||
*source_tree = repo_get_commit_tree(the_repository,
|
||||
new_branch_info->commit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1339,7 +1345,7 @@ static int parse_branchname_arg(int argc, const char **argv,
|
|||
if (!strcmp(arg, "-"))
|
||||
arg = "@{-1}";
|
||||
|
||||
if (get_oid_mb(arg, rev)) {
|
||||
if (repo_get_oid_mb(the_repository, arg, rev)) {
|
||||
/*
|
||||
* Either case (3) or (4), with <something> not being
|
||||
* a commit, or an attempt to use case (1) with an
|
||||
|
@ -1436,7 +1442,8 @@ static void die_expecting_a_branch(const struct branch_info *branch_info)
|
|||
char *to_free;
|
||||
int code;
|
||||
|
||||
if (dwim_ref(branch_info->name, strlen(branch_info->name), &oid, &to_free, 0) == 1) {
|
||||
if (repo_dwim_ref(the_repository, branch_info->name,
|
||||
strlen(branch_info->name), &oid, &to_free, 0) == 1) {
|
||||
const char *ref = to_free;
|
||||
|
||||
if (skip_prefix(ref, "refs/tags/", &ref))
|
||||
|
@ -1765,7 +1772,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
|
|||
} else if (!opts->accept_ref && opts->from_treeish) {
|
||||
struct object_id rev;
|
||||
|
||||
if (get_oid_mb(opts->from_treeish, &rev))
|
||||
if (repo_get_oid_mb(the_repository, opts->from_treeish, &rev))
|
||||
die(_("could not resolve %s"), opts->from_treeish);
|
||||
|
||||
setup_new_branch_info_and_source_tree(new_branch_info,
|
||||
|
|
|
@ -552,9 +552,9 @@ static void write_followtags(const struct ref *refs, const char *msg)
|
|||
continue;
|
||||
if (ends_with(ref->name, "^{}"))
|
||||
continue;
|
||||
if (!has_object_file_with_flags(&ref->old_oid,
|
||||
OBJECT_INFO_QUICK |
|
||||
OBJECT_INFO_SKIP_FETCH_OBJECT))
|
||||
if (!repo_has_object_file_with_flags(the_repository, &ref->old_oid,
|
||||
OBJECT_INFO_QUICK |
|
||||
OBJECT_INFO_SKIP_FETCH_OBJECT))
|
||||
continue;
|
||||
update_ref(msg, ref->name, &ref->old_oid, NULL, 0,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
|
|
|
@ -47,7 +47,7 @@ static int parse_parent_arg_callback(const struct option *opt,
|
|||
|
||||
BUG_ON_OPT_NEG_NOARG(unset, arg);
|
||||
|
||||
if (get_oid_commit(arg, &oid))
|
||||
if (repo_get_oid_commit(the_repository, arg, &oid))
|
||||
die(_("not a valid object name %s"), arg);
|
||||
|
||||
assert_oid_type(&oid, OBJ_COMMIT);
|
||||
|
@ -125,7 +125,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
|
|||
if (argc != 1)
|
||||
die(_("must give exactly one tree"));
|
||||
|
||||
if (get_oid_tree(argv[0], &tree_oid))
|
||||
if (repo_get_oid_tree(the_repository, argv[0], &tree_oid))
|
||||
die(_("not a valid object name %s"), argv[0]);
|
||||
|
||||
if (!buffer.len) {
|
||||
|
|
|
@ -559,7 +559,7 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
|
|||
s->index_file = index_file;
|
||||
s->fp = fp;
|
||||
s->nowarn = nowarn;
|
||||
s->is_initial = get_oid(s->reference, &oid) ? 1 : 0;
|
||||
s->is_initial = repo_get_oid(the_repository, s->reference, &oid) ? 1 : 0;
|
||||
if (!s->is_initial)
|
||||
oidcpy(&s->oid_commit, &oid);
|
||||
s->status_format = status_format;
|
||||
|
@ -714,15 +714,15 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb,
|
|||
{
|
||||
const char *buffer, *subject, *fmt;
|
||||
|
||||
buffer = get_commit_buffer(commit, NULL);
|
||||
buffer = repo_get_commit_buffer(the_repository, commit, NULL);
|
||||
find_commit_subject(buffer, &subject);
|
||||
/*
|
||||
* If we amend the 'amend!' commit then we don't want to
|
||||
* duplicate the subject line.
|
||||
*/
|
||||
fmt = starts_with(subject, "amend!") ? "%b" : "%B";
|
||||
format_commit_message(commit, fmt, sb, ctx);
|
||||
unuse_commit_buffer(commit, buffer);
|
||||
repo_format_commit_message(the_repository, commit, fmt, sb, ctx);
|
||||
repo_unuse_commit_buffer(the_repository, commit, buffer);
|
||||
}
|
||||
|
||||
static int prepare_to_commit(const char *index_file, const char *prefix,
|
||||
|
@ -762,8 +762,9 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||
if (!c)
|
||||
die(_("could not lookup commit %s"), squash_message);
|
||||
ctx.output_encoding = get_commit_output_encoding();
|
||||
format_commit_message(c, "squash! %s\n\n", &sb,
|
||||
&ctx);
|
||||
repo_format_commit_message(the_repository, c,
|
||||
"squash! %s\n\n", &sb,
|
||||
&ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -797,7 +798,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||
die(_("could not lookup commit %s"), fixup_commit);
|
||||
ctx.output_encoding = get_commit_output_encoding();
|
||||
fmt = xstrfmt("%s! %%s\n\n", fixup_prefix);
|
||||
format_commit_message(commit, fmt, &sb, &ctx);
|
||||
repo_format_commit_message(the_repository, commit, fmt, &sb,
|
||||
&ctx);
|
||||
free(fmt);
|
||||
hook_arg1 = "message";
|
||||
|
||||
|
@ -1002,7 +1004,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||
if (amend)
|
||||
parent = "HEAD^1";
|
||||
|
||||
if (get_oid(parent, &oid)) {
|
||||
if (repo_get_oid(the_repository, parent, &oid)) {
|
||||
int i, ita_nr = 0;
|
||||
|
||||
/* TODO: audit for interaction with sparse-index. */
|
||||
|
@ -1137,7 +1139,8 @@ static const char *find_author_by_nickname(const char *name)
|
|||
struct pretty_print_context ctx = {0};
|
||||
ctx.date_mode.type = DATE_NORMAL;
|
||||
strbuf_release(&buf);
|
||||
format_commit_message(commit, "%aN <%aE>", &buf, &ctx);
|
||||
repo_format_commit_message(the_repository, commit,
|
||||
"%aN <%aE>", &buf, &ctx);
|
||||
release_revisions(&revs);
|
||||
return strbuf_detach(&buf, NULL);
|
||||
}
|
||||
|
@ -1185,7 +1188,7 @@ static const char *read_commit_message(const char *name)
|
|||
if (!commit)
|
||||
die(_("could not lookup commit %s"), name);
|
||||
out_enc = get_commit_output_encoding();
|
||||
return logmsg_reencode(commit, NULL, out_enc);
|
||||
return repo_logmsg_reencode(the_repository, commit, NULL, out_enc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1569,7 +1572,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
|
|||
else
|
||||
fd = -1;
|
||||
|
||||
s.is_initial = get_oid(s.reference, &oid) ? 1 : 0;
|
||||
s.is_initial = repo_get_oid(the_repository, s.reference, &oid) ? 1 : 0;
|
||||
if (!s.is_initial)
|
||||
oidcpy(&s.oid_commit, &oid);
|
||||
|
||||
|
@ -1712,11 +1715,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
|||
status_format = STATUS_FORMAT_NONE; /* Ignore status.short */
|
||||
s.colopts = 0;
|
||||
|
||||
if (get_oid("HEAD", &oid))
|
||||
if (repo_get_oid(the_repository, "HEAD", &oid))
|
||||
current_head = NULL;
|
||||
else {
|
||||
current_head = lookup_commit_or_die(&oid, "HEAD");
|
||||
if (parse_commit(current_head))
|
||||
if (repo_parse_commit(the_repository, current_head))
|
||||
die(_("could not parse HEAD commit"));
|
||||
}
|
||||
verbose = -1; /* unspecified */
|
||||
|
|
|
@ -265,7 +265,7 @@ static unsigned long finish_depth_computation(
|
|||
best->depth++;
|
||||
while (parents) {
|
||||
struct commit *p = parents->item;
|
||||
parse_commit(p);
|
||||
repo_parse_commit(the_repository, p);
|
||||
if (!(p->object.flags & SEEN))
|
||||
commit_list_insert_by_date(p, list);
|
||||
p->object.flags |= c->object.flags;
|
||||
|
@ -302,7 +302,8 @@ static void append_name(struct commit_name *n, struct strbuf *dst)
|
|||
|
||||
static void append_suffix(int depth, const struct object_id *oid, struct strbuf *dst)
|
||||
{
|
||||
strbuf_addf(dst, "-%d-g%s", depth, find_unique_abbrev(oid, abbrev));
|
||||
strbuf_addf(dst, "-%d-g%s", depth,
|
||||
repo_find_unique_abbrev(the_repository, oid, abbrev));
|
||||
}
|
||||
|
||||
static void describe_commit(struct object_id *oid, struct strbuf *dst)
|
||||
|
@ -407,7 +408,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst)
|
|||
}
|
||||
while (parents) {
|
||||
struct commit *p = parents->item;
|
||||
parse_commit(p);
|
||||
repo_parse_commit(the_repository, p);
|
||||
if (!(p->object.flags & SEEN))
|
||||
commit_list_insert_by_date(p, &list);
|
||||
p->object.flags |= c->object.flags;
|
||||
|
@ -535,7 +536,7 @@ static void describe(const char *arg, int last_one)
|
|||
if (debug)
|
||||
fprintf(stderr, _("describe %s\n"), arg);
|
||||
|
||||
if (get_oid(arg, &oid))
|
||||
if (repo_get_oid(the_repository, arg, &oid))
|
||||
die(_("Not a valid object name %s"), arg);
|
||||
cmit = lookup_commit_reference_gently(the_repository, &oid, 1);
|
||||
|
||||
|
|
|
@ -550,7 +550,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
|||
if (!obj)
|
||||
die(_("invalid object '%s' given."), name);
|
||||
if (obj->type == OBJ_COMMIT)
|
||||
obj = &get_commit_tree(((struct commit *)obj))->object;
|
||||
obj = &repo_get_commit_tree(the_repository,
|
||||
((struct commit *)obj))->object;
|
||||
|
||||
if (obj->type == OBJ_TREE) {
|
||||
if (sdiff.skip && bitmap_get(sdiff.skip, i))
|
||||
|
|
|
@ -301,7 +301,8 @@ static char *get_symlink(const struct object_id *oid, const char *path)
|
|||
} else {
|
||||
enum object_type type;
|
||||
unsigned long size;
|
||||
data = read_object_file(oid, &type, &size);
|
||||
data = repo_read_object_file(the_repository, oid, &type,
|
||||
&size);
|
||||
if (!data)
|
||||
die(_("could not read object %s for symlink %s"),
|
||||
oid_to_hex(oid), path);
|
||||
|
|
|
@ -298,7 +298,7 @@ static void export_blob(const struct object_id *oid)
|
|||
object = (struct object *)lookup_blob(the_repository, oid);
|
||||
eaten = 0;
|
||||
} else {
|
||||
buf = read_object_file(oid, &type, &size);
|
||||
buf = repo_read_object_file(the_repository, oid, &type, &size);
|
||||
if (!buf)
|
||||
die("could not read blob %s", oid_to_hex(oid));
|
||||
if (check_object_signature(the_repository, oid, buf, size,
|
||||
|
@ -620,7 +620,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
|
|||
rev->diffopt.output_format = DIFF_FORMAT_CALLBACK;
|
||||
|
||||
parse_commit_or_die(commit);
|
||||
commit_buffer = get_commit_buffer(commit, NULL);
|
||||
commit_buffer = repo_get_commit_buffer(the_repository, commit, NULL);
|
||||
author = strstr(commit_buffer, "\nauthor ");
|
||||
if (!author)
|
||||
die("could not find author in commit %s",
|
||||
|
@ -701,7 +701,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev,
|
|||
? strlen(message) : 0),
|
||||
reencoded ? reencoded : message ? message : "");
|
||||
free(reencoded);
|
||||
unuse_commit_buffer(commit, commit_buffer);
|
||||
repo_unuse_commit_buffer(the_repository, commit, commit_buffer);
|
||||
|
||||
for (i = 0, p = commit->parents; p; p = p->next) {
|
||||
struct object *obj = &p->item->object;
|
||||
|
@ -768,7 +768,8 @@ static void handle_tag(const char *name, struct tag *tag)
|
|||
return;
|
||||
}
|
||||
|
||||
buf = read_object_file(&tag->object.oid, &type, &size);
|
||||
buf = repo_read_object_file(the_repository, &tag->object.oid, &type,
|
||||
&size);
|
||||
if (!buf)
|
||||
die("could not read tag %s", oid_to_hex(&tag->object.oid));
|
||||
message = memmem(buf, size, "\n\n", 2);
|
||||
|
@ -919,7 +920,8 @@ static void get_tags_and_duplicates(struct rev_cmdline_info *info)
|
|||
if (e->flags & UNINTERESTING)
|
||||
continue;
|
||||
|
||||
if (dwim_ref(e->name, strlen(e->name), &oid, &full_name, 0) != 1)
|
||||
if (repo_dwim_ref(the_repository, e->name, strlen(e->name),
|
||||
&oid, &full_name, 0) != 1)
|
||||
continue;
|
||||
|
||||
if (refspecs.nr) {
|
||||
|
|
|
@ -1270,7 +1270,7 @@ static void load_tree(struct tree_entry *root)
|
|||
die("Can't load tree %s", oid_to_hex(oid));
|
||||
} else {
|
||||
enum object_type type;
|
||||
buf = read_object_file(oid, &type, &size);
|
||||
buf = repo_read_object_file(the_repository, oid, &type, &size);
|
||||
if (!buf || type != OBJ_TREE)
|
||||
die("Can't load tree %s", oid_to_hex(oid));
|
||||
}
|
||||
|
@ -1630,7 +1630,7 @@ static int update_branch(struct branch *b)
|
|||
if (!old_cmit || !new_cmit)
|
||||
return error("Branch %s is missing commits.", b->name);
|
||||
|
||||
if (!in_merge_bases(old_cmit, new_cmit)) {
|
||||
if (!repo_in_merge_bases(the_repository, old_cmit, new_cmit)) {
|
||||
warning("Not updating %s"
|
||||
" (new tip %s does not contain %s)",
|
||||
b->name, oid_to_hex(&b->oid),
|
||||
|
@ -2491,7 +2491,7 @@ static void note_change_n(const char *p, struct branch *b, unsigned char *old_fa
|
|||
if (commit_oe->type != OBJ_COMMIT)
|
||||
die("Mark :%" PRIuMAX " not a commit", commit_mark);
|
||||
oidcpy(&commit_oid, &commit_oe->idx.oid);
|
||||
} else if (!get_oid(p, &commit_oid)) {
|
||||
} else if (!repo_get_oid(the_repository, p, &commit_oid)) {
|
||||
unsigned long size;
|
||||
char *buf = read_object_with_reference(the_repository,
|
||||
&commit_oid,
|
||||
|
@ -2604,7 +2604,7 @@ static int parse_objectish(struct branch *b, const char *objectish)
|
|||
} else
|
||||
parse_from_existing(b);
|
||||
}
|
||||
} else if (!get_oid(objectish, &b->oid)) {
|
||||
} else if (!repo_get_oid(the_repository, objectish, &b->oid)) {
|
||||
parse_from_existing(b);
|
||||
if (is_null_oid(&b->oid))
|
||||
b->delete = 1;
|
||||
|
@ -2659,7 +2659,7 @@ static struct hash_list *parse_merge(unsigned int *count)
|
|||
if (oe->type != OBJ_COMMIT)
|
||||
die("Mark :%" PRIuMAX " not a commit", idnum);
|
||||
oidcpy(&n->oid, &oe->idx.oid);
|
||||
} else if (!get_oid(from, &n->oid)) {
|
||||
} else if (!repo_get_oid(the_repository, from, &n->oid)) {
|
||||
unsigned long size;
|
||||
char *buf = read_object_with_reference(the_repository,
|
||||
&n->oid,
|
||||
|
@ -2832,7 +2832,7 @@ static void parse_new_tag(const char *arg)
|
|||
oe = find_mark(marks, from_mark);
|
||||
type = oe->type;
|
||||
oidcpy(&oid, &oe->idx.oid);
|
||||
} else if (!get_oid(from, &oid)) {
|
||||
} else if (!repo_get_oid(the_repository, from, &oid)) {
|
||||
struct object_entry *oe = find_object(&oid);
|
||||
if (!oe) {
|
||||
type = oid_object_info(the_repository, &oid, NULL);
|
||||
|
@ -2941,7 +2941,7 @@ static void cat_blob(struct object_entry *oe, struct object_id *oid)
|
|||
char *buf;
|
||||
|
||||
if (!oe || oe->pack_id == MAX_PACK_ID) {
|
||||
buf = read_object_file(oid, &type, &size);
|
||||
buf = repo_read_object_file(the_repository, oid, &type, &size);
|
||||
} else {
|
||||
type = oe->type;
|
||||
buf = gfi_unpack_entry(oe, &size);
|
||||
|
@ -3049,7 +3049,8 @@ static struct object_entry *dereference(struct object_entry *oe,
|
|||
buf = gfi_unpack_entry(oe, &size);
|
||||
} else {
|
||||
enum object_type unused;
|
||||
buf = read_object_file(oid, &unused, &size);
|
||||
buf = repo_read_object_file(the_repository, oid, &unused,
|
||||
&size);
|
||||
}
|
||||
if (!buf)
|
||||
die("Can't load object %s", oid_to_hex(oid));
|
||||
|
|