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:
Junio C Hamano
2023-04-04 08:25:52 -07:00
148 changed files with 958 additions and 873 deletions

View File

@ -238,7 +238,8 @@ static void show_parents(struct commit *commit, int abbrev, FILE *file)
struct commit_list *p;
for (p = commit->parents; p ; p = p->next) {
struct commit *parent = p->item;
fprintf(file, " %s", find_unique_abbrev(&parent->object.oid, abbrev));
fprintf(file, " %s",
repo_find_unique_abbrev(the_repository, &parent->object.oid, abbrev));
}
}
@ -246,7 +247,8 @@ static void show_children(struct rev_info *opt, struct commit *commit, int abbre
{
struct commit_list *p = lookup_decoration(&opt->children, &commit->object);
for ( ; p; p = p->next) {
fprintf(opt->diffopt.file, " %s", find_unique_abbrev(&p->item->object.oid, abbrev));
fprintf(opt->diffopt.file, " %s",
repo_find_unique_abbrev(the_repository, &p->item->object.oid, abbrev));
}
}
@ -410,7 +412,8 @@ void fmt_output_commit(struct strbuf *filename,
struct pretty_print_context ctx = {0};
struct strbuf subject = STRBUF_INIT;
format_commit_message(commit, "%f", &subject, &ctx);
repo_format_commit_message(the_repository, commit, "%f", &subject,
&ctx);
fmt_output_subject(filename, subject.buf, info);
strbuf_release(&subject);
}
@ -649,7 +652,8 @@ void show_log(struct rev_info *opt)
if (!opt->graph)
put_revision_mark(opt, commit);
fputs(find_unique_abbrev(&commit->object.oid, abbrev_commit), opt->diffopt.file);
fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev_commit),
opt->diffopt.file);
if (opt->print_parents)
show_parents(commit, abbrev_commit, opt->diffopt.file);
if (opt->children.name)
@ -711,8 +715,8 @@ void show_log(struct rev_info *opt)
if (!opt->graph)
put_revision_mark(opt, commit);
fputs(find_unique_abbrev(&commit->object.oid,
abbrev_commit),
fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid,
abbrev_commit),
opt->diffopt.file);
if (opt->print_parents)
show_parents(commit, abbrev_commit, opt->diffopt.file);
@ -720,7 +724,7 @@ void show_log(struct rev_info *opt)
show_children(opt, commit, abbrev_commit);
if (parent)
fprintf(opt->diffopt.file, " (from %s)",
find_unique_abbrev(&parent->object.oid, abbrev_commit));
repo_find_unique_abbrev(the_repository, &parent->object.oid, abbrev_commit));
fputs(diff_get_color_opt(&opt->diffopt, DIFF_RESET), opt->diffopt.file);
show_decorations(opt, commit);
if (opt->commit_format == CMIT_FMT_ONELINE) {
@ -851,7 +855,7 @@ void show_log(struct rev_info *opt)
* Pass minimum required diff-options to range-diff; others
* can be added later if deemed desirable.
*/
diff_setup(&opts);
repo_diff_setup(the_repository, &opts);
opts.file = opt->diffopt.file;
opts.use_color = opt->diffopt.use_color;
diff_setup_done(&opts);
@ -987,15 +991,17 @@ static int do_remerge_diff(struct rev_info *opt,
o.msg_header_prefix = "remerge";
ctx.abbrev = DEFAULT_ABBREV;
format_commit_message(parent1, "%h (%s)", &parent1_desc, &ctx);
format_commit_message(parent2, "%h (%s)", &parent2_desc, &ctx);
repo_format_commit_message(the_repository, parent1, "%h (%s)",
&parent1_desc, &ctx);
repo_format_commit_message(the_repository, parent2, "%h (%s)",
&parent2_desc, &ctx);
o.branch1 = parent1_desc.buf;
o.branch2 = parent2_desc.buf;
/* Parse the relevant commits and get the merge bases */
parse_commit_or_die(parent1);
parse_commit_or_die(parent2);
bases = get_merge_bases(parent1, parent2);
bases = repo_get_merge_bases(the_repository, parent1, parent2);
/* Re-merge the parents */
merge_incore_recursive(&o, bases, parent1, parent2, &res);