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

@ -142,7 +142,9 @@ static void show_rev(int type, const struct object_id *oid, const char *name)
struct object_id discard;
char *full;
switch (dwim_ref(name, strlen(name), &discard, &full, 0)) {
switch (repo_dwim_ref(the_repository, name,
strlen(name), &discard, &full,
0)) {
case 0:
/*
* Not found -- not a ref. We could
@ -168,7 +170,8 @@ static void show_rev(int type, const struct object_id *oid, const char *name)
}
}
else if (abbrev)
show_with_type(type, find_unique_abbrev(oid, abbrev));
show_with_type(type,
repo_find_unique_abbrev(the_repository, oid, abbrev));
else
show_with_type(type, oid_to_hex(oid));
}
@ -193,7 +196,7 @@ static int show_default(void)
struct object_id oid;
def = NULL;
if (!get_oid(s, &oid)) {
if (!repo_get_oid(the_repository, s, &oid)) {
show_rev(NORMAL, &oid, s);
return 1;
}
@ -285,7 +288,7 @@ static int try_difference(const char *arg)
return 0;
}
if (!get_oid_committish(start, &start_oid) && !get_oid_committish(end, &end_oid)) {
if (!repo_get_oid_committish(the_repository, start, &start_oid) && !repo_get_oid_committish(the_repository, end, &end_oid)) {
show_rev(NORMAL, &end_oid, end);
show_rev(symmetric ? NORMAL : REVERSED, &start_oid, start);
if (symmetric) {
@ -297,7 +300,7 @@ static int try_difference(const char *arg)
*dotdot = '.';
return 0;
}
exclude = get_merge_bases(a, b);
exclude = repo_get_merge_bases(the_repository, a, b);
while (exclude) {
struct commit *commit = pop_commit(&exclude);
show_rev(REVERSED, &commit->object.oid, NULL);
@ -343,7 +346,7 @@ static int try_parent_shorthands(const char *arg)
return 0;
*dotdot = 0;
if (get_oid_committish(arg, &oid) ||
if (repo_get_oid_committish(the_repository, arg, &oid) ||
!(commit = lookup_commit_reference(the_repository, &oid))) {
*dotdot = '^';
return 0;
@ -874,7 +877,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
continue;
}
if (skip_prefix(arg, "--disambiguate=", &arg)) {
for_each_abbrev(arg, show_abbrev, NULL);
repo_for_each_abbrev(the_repository, arg,
show_abbrev, NULL);
continue;
}
if (!strcmp(arg, "--bisect")) {