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:
44
commit.c
44
commit.c
@ -84,10 +84,10 @@ struct commit *lookup_commit_reference_by_name(const char *name)
|
||||
struct object_id oid;
|
||||
struct commit *commit;
|
||||
|
||||
if (get_oid_committish(name, &oid))
|
||||
if (repo_get_oid_committish(the_repository, name, &oid))
|
||||
return NULL;
|
||||
commit = lookup_commit_reference(the_repository, &oid);
|
||||
if (parse_commit(commit))
|
||||
if (repo_parse_commit(the_repository, commit))
|
||||
return NULL;
|
||||
return commit;
|
||||
}
|
||||
@ -386,7 +386,7 @@ struct tree *repo_get_commit_tree(struct repository *r,
|
||||
|
||||
struct object_id *get_commit_tree_oid(const struct commit *commit)
|
||||
{
|
||||
struct tree *tree = get_commit_tree(commit);
|
||||
struct tree *tree = repo_get_commit_tree(the_repository, commit);
|
||||
return tree ? &tree->object.oid : NULL;
|
||||
}
|
||||
|
||||
@ -559,7 +559,7 @@ int repo_parse_commit_gently(struct repository *r,
|
||||
|
||||
void parse_commit_or_die(struct commit *item)
|
||||
{
|
||||
if (parse_commit(item))
|
||||
if (repo_parse_commit(the_repository, item))
|
||||
die("unable to parse commit %s",
|
||||
item ? oid_to_hex(&item->object.oid) : "(null)");
|
||||
}
|
||||
@ -692,7 +692,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
|
||||
|
||||
while (parents) {
|
||||
struct commit *commit = parents->item;
|
||||
if (!parse_commit(commit) && !(commit->object.flags & mark)) {
|
||||
if (!repo_parse_commit(the_repository, commit) && !(commit->object.flags & mark)) {
|
||||
commit->object.flags |= mark;
|
||||
commit_list_insert_by_date(commit, list);
|
||||
}
|
||||
@ -766,7 +766,8 @@ define_commit_slab(author_date_slab, timestamp_t);
|
||||
void record_author_date(struct author_date_slab *author_date,
|
||||
struct commit *commit)
|
||||
{
|
||||
const char *buffer = get_commit_buffer(commit, NULL);
|
||||
const char *buffer = repo_get_commit_buffer(the_repository, commit,
|
||||
NULL);
|
||||
struct ident_split ident;
|
||||
const char *ident_line;
|
||||
size_t ident_len;
|
||||
@ -786,7 +787,7 @@ void record_author_date(struct author_date_slab *author_date,
|
||||
*(author_date_slab_at(author_date, commit)) = date;
|
||||
|
||||
fail_exit:
|
||||
unuse_commit_buffer(commit, buffer);
|
||||
repo_unuse_commit_buffer(the_repository, commit, buffer);
|
||||
}
|
||||
|
||||
int compare_commits_by_author_date(const void *a_, const void *b_,
|
||||
@ -969,7 +970,7 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs)
|
||||
commit = lookup_commit(the_repository, oid);
|
||||
if (!commit ||
|
||||
(commit->object.flags & TMP_MARK) ||
|
||||
parse_commit(commit))
|
||||
repo_parse_commit(the_repository, commit))
|
||||
return;
|
||||
|
||||
ALLOC_GROW(revs->commit, revs->nr + 1, revs->alloc);
|
||||
@ -1001,7 +1002,8 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
|
||||
struct commit *ret = NULL;
|
||||
char *full_refname;
|
||||
|
||||
switch (dwim_ref(refname, strlen(refname), &oid, &full_refname, 0)) {
|
||||
switch (repo_dwim_ref(the_repository, refname, strlen(refname), &oid,
|
||||
&full_refname, 0)) {
|
||||
case 0:
|
||||
die("No such ref: '%s'", refname);
|
||||
case 1:
|
||||
@ -1020,7 +1022,8 @@ struct commit *get_fork_point(const char *refname, struct commit *commit)
|
||||
for (i = 0; i < revs.nr; i++)
|
||||
revs.commit[i]->object.flags &= ~TMP_MARK;
|
||||
|
||||
bases = get_merge_bases_many(commit, revs.nr, revs.commit);
|
||||
bases = repo_get_merge_bases_many(the_repository, commit, revs.nr,
|
||||
revs.commit);
|
||||
|
||||
/*
|
||||
* There should be one and only one merge base, when we found
|
||||
@ -1101,10 +1104,11 @@ int parse_signed_commit(const struct commit *commit,
|
||||
const struct git_hash_algo *algop)
|
||||
{
|
||||
unsigned long size;
|
||||
const char *buffer = get_commit_buffer(commit, &size);
|
||||
const char *buffer = repo_get_commit_buffer(the_repository, commit,
|
||||
&size);
|
||||
int ret = parse_buffer_signed_by_header(buffer, size, payload, signature, algop);
|
||||
|
||||
unuse_commit_buffer(commit, buffer);
|
||||
repo_unuse_commit_buffer(the_repository, commit, buffer);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1215,7 +1219,8 @@ static void handle_signed_tag(struct commit *parent, struct commit_extra_header
|
||||
desc = merge_remote_util(parent);
|
||||
if (!desc || !desc->obj)
|
||||
return;
|
||||
buf = read_object_file(&desc->obj->oid, &type, &size);
|
||||
buf = repo_read_object_file(the_repository, &desc->obj->oid, &type,
|
||||
&size);
|
||||
if (!buf || type != OBJ_TAG)
|
||||
goto free_return;
|
||||
if (!parse_signature(buf, size, &payload, &signature))
|
||||
@ -1277,7 +1282,8 @@ void verify_merge_signature(struct commit *commit, int verbosity,
|
||||
|
||||
ret = check_commit_signature(commit, &signature_check);
|
||||
|
||||
find_unique_abbrev_r(hex, &commit->object.oid, DEFAULT_ABBREV);
|
||||
repo_find_unique_abbrev_r(the_repository, hex, &commit->object.oid,
|
||||
DEFAULT_ABBREV);
|
||||
switch (signature_check.result) {
|
||||
case 'G':
|
||||
if (ret || (check_trust && signature_check.trust_level < TRUST_MARGINAL))
|
||||
@ -1322,9 +1328,10 @@ struct commit_extra_header *read_commit_extra_headers(struct commit *commit,
|
||||
{
|
||||
struct commit_extra_header *extra = NULL;
|
||||
unsigned long size;
|
||||
const char *buffer = get_commit_buffer(commit, &size);
|
||||
const char *buffer = repo_get_commit_buffer(the_repository, commit,
|
||||
&size);
|
||||
extra = read_commit_extra_header_lines(buffer, size, exclude);
|
||||
unuse_commit_buffer(commit, buffer);
|
||||
repo_unuse_commit_buffer(the_repository, commit, buffer);
|
||||
return extra;
|
||||
}
|
||||
|
||||
@ -1638,10 +1645,11 @@ struct commit *get_merge_parent(const char *name)
|
||||
struct object *obj;
|
||||
struct commit *commit;
|
||||
struct object_id oid;
|
||||
if (get_oid(name, &oid))
|
||||
if (repo_get_oid(the_repository, name, &oid))
|
||||
return NULL;
|
||||
obj = parse_object(the_repository, &oid);
|
||||
commit = (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
|
||||
commit = (struct commit *)repo_peel_to_type(the_repository, name, 0,
|
||||
obj, OBJ_COMMIT);
|
||||
if (commit && !merge_remote_util(commit))
|
||||
set_merge_remote_desc(commit, name, obj);
|
||||
return commit;
|
||||
|
Reference in New Issue
Block a user