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:
@ -29,7 +29,8 @@
|
||||
|
||||
static const char *short_commit_name(struct commit *commit)
|
||||
{
|
||||
return find_unique_abbrev(&commit->object.oid, DEFAULT_ABBREV);
|
||||
return repo_find_unique_abbrev(the_repository, &commit->object.oid,
|
||||
DEFAULT_ABBREV);
|
||||
}
|
||||
|
||||
static struct commit *peel_committish(const char *name)
|
||||
@ -37,10 +38,11 @@ static struct commit *peel_committish(const char *name)
|
||||
struct object *obj;
|
||||
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);
|
||||
return (struct commit *)peel_to_type(name, 0, obj, OBJ_COMMIT);
|
||||
return (struct commit *)repo_peel_to_type(the_repository, name, 0, obj,
|
||||
OBJ_COMMIT);
|
||||
}
|
||||
|
||||
static char *get_author(const char *message)
|
||||
@ -67,7 +69,8 @@ static struct commit *create_commit(struct tree *tree,
|
||||
struct commit_extra_header *extra;
|
||||
struct strbuf msg = STRBUF_INIT;
|
||||
const char *out_enc = get_commit_output_encoding();
|
||||
const char *message = logmsg_reencode(based_on, NULL, out_enc);
|
||||
const char *message = repo_logmsg_reencode(the_repository, based_on,
|
||||
NULL, out_enc);
|
||||
const char *orig_message = NULL;
|
||||
const char *exclude_gpgsig[] = { "gpgsig", NULL };
|
||||
|
||||
@ -123,7 +126,7 @@ int cmd__fast_rebase(int argc, const char **argv)
|
||||
strbuf_addf(&branch_name, "refs/heads/%s", argv[4]);
|
||||
|
||||
/* Sanity check */
|
||||
if (get_oid("HEAD", &head))
|
||||
if (repo_get_oid(the_repository, "HEAD", &head))
|
||||
die(_("Cannot read HEAD"));
|
||||
assert(oideq(&onto->object.oid, &head));
|
||||
|
||||
@ -158,7 +161,7 @@ int cmd__fast_rebase(int argc, const char **argv)
|
||||
memset(&result, 0, sizeof(result));
|
||||
merge_opt.show_rename_progress = 1;
|
||||
merge_opt.branch1 = "HEAD";
|
||||
head_tree = get_commit_tree(onto);
|
||||
head_tree = repo_get_commit_tree(the_repository, onto);
|
||||
result.tree = head_tree;
|
||||
last_commit = onto;
|
||||
while ((commit = get_revision(&revs))) {
|
||||
@ -169,8 +172,8 @@ int cmd__fast_rebase(int argc, const char **argv)
|
||||
assert(commit->parents && !commit->parents->next);
|
||||
base = commit->parents->item;
|
||||
|
||||
next_tree = get_commit_tree(commit);
|
||||
base_tree = get_commit_tree(base);
|
||||
next_tree = repo_get_commit_tree(the_repository, commit);
|
||||
base_tree = repo_get_commit_tree(the_repository, base);
|
||||
|
||||
merge_opt.branch2 = short_commit_name(commit);
|
||||
merge_opt.ancestor = xstrfmt("parent of %s", merge_opt.branch2);
|
||||
|
@ -11,9 +11,9 @@ int cmd__match_trees(int ac, const char **av)
|
||||
|
||||
setup_git_directory();
|
||||
|
||||
if (get_oid(av[1], &hash1))
|
||||
if (repo_get_oid(the_repository, av[1], &hash1))
|
||||
die("cannot parse %s as an object name", av[1]);
|
||||
if (get_oid(av[2], &hash2))
|
||||
if (repo_get_oid(the_repository, av[2], &hash2))
|
||||
die("cannot parse %s as an object name", av[2]);
|
||||
one = parse_tree_indirect(&hash1);
|
||||
if (!one)
|
||||
|
@ -51,7 +51,7 @@ int cmd__oidmap(int argc, const char **argv)
|
||||
|
||||
if (!strcmp("put", cmd) && p1 && p2) {
|
||||
|
||||
if (get_oid(p1, &oid)) {
|
||||
if (repo_get_oid(the_repository, p1, &oid)) {
|
||||
printf("Unknown oid: %s\n", p1);
|
||||
continue;
|
||||
}
|
||||
@ -69,7 +69,7 @@ int cmd__oidmap(int argc, const char **argv)
|
||||
|
||||
} else if (!strcmp("get", cmd) && p1) {
|
||||
|
||||
if (get_oid(p1, &oid)) {
|
||||
if (repo_get_oid(the_repository, p1, &oid)) {
|
||||
printf("Unknown oid: %s\n", p1);
|
||||
continue;
|
||||
}
|
||||
@ -82,7 +82,7 @@ int cmd__oidmap(int argc, const char **argv)
|
||||
|
||||
} else if (!strcmp("remove", cmd) && p1) {
|
||||
|
||||
if (get_oid(p1, &oid)) {
|
||||
if (repo_get_oid(the_repository, p1, &oid)) {
|
||||
printf("Unknown oid: %s\n", p1);
|
||||
continue;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ int cmd__reach(int ac, const char **av)
|
||||
if (buf.len < 3)
|
||||
continue;
|
||||
|
||||
if (get_oid_committish(buf.buf + 2, &oid))
|
||||
if (repo_get_oid_committish(the_repository, buf.buf + 2, &oid))
|
||||
die("failed to resolve %s", buf.buf + 2);
|
||||
|
||||
orig = parse_object(r, &oid);
|
||||
@ -110,13 +110,17 @@ int cmd__reach(int ac, const char **av)
|
||||
if (!strcmp(av[1], "ref_newer"))
|
||||
printf("%s(A,B):%d\n", av[1], ref_newer(&oid_A, &oid_B));
|
||||
else if (!strcmp(av[1], "in_merge_bases"))
|
||||
printf("%s(A,B):%d\n", av[1], in_merge_bases(A, B));
|
||||
printf("%s(A,B):%d\n", av[1],
|
||||
repo_in_merge_bases(the_repository, A, B));
|
||||
else if (!strcmp(av[1], "in_merge_bases_many"))
|
||||
printf("%s(A,X):%d\n", av[1], in_merge_bases_many(A, X_nr, X_array));
|
||||
printf("%s(A,X):%d\n", av[1],
|
||||
repo_in_merge_bases_many(the_repository, A, X_nr, X_array));
|
||||
else if (!strcmp(av[1], "is_descendant_of"))
|
||||
printf("%s(A,X):%d\n", av[1], repo_is_descendant_of(r, A, X));
|
||||
else if (!strcmp(av[1], "get_merge_bases_many")) {
|
||||
struct commit_list *list = get_merge_bases_many(A, X_nr, X_array);
|
||||
struct commit_list *list = repo_get_merge_bases_many(the_repository,
|
||||
A, X_nr,
|
||||
X_array);
|
||||
printf("%s(A,X):\n", av[1]);
|
||||
print_sorted_commit_ids(list);
|
||||
} else if (!strcmp(av[1], "reduce_heads")) {
|
||||
|
@ -19,7 +19,8 @@ static void print_commit(struct commit *commit)
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
struct pretty_print_context ctx = {0};
|
||||
ctx.date_mode.type = DATE_NORMAL;
|
||||
format_commit_message(commit, " %m %s", &sb, &ctx);
|
||||
repo_format_commit_message(the_repository, commit, " %m %s", &sb,
|
||||
&ctx);
|
||||
printf("%s\n", sb.buf);
|
||||
strbuf_release(&sb);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ int cmd__submodule_config(int argc, const char **argv)
|
||||
|
||||
if (commit[0] == '\0')
|
||||
oidclr(&commit_oid);
|
||||
else if (get_oid(commit, &commit_oid) < 0)
|
||||
else if (repo_get_oid(the_repository, commit, &commit_oid) < 0)
|
||||
die_usage(argc, argv, "Commit not found.");
|
||||
|
||||
if (lookup_name) {
|
||||
|
Reference in New Issue
Block a user