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:
@ -206,7 +206,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
|
||||
|
||||
revision = info->revision.buf;
|
||||
|
||||
if (get_oid(revision, &info->w_commit))
|
||||
if (repo_get_oid(the_repository, revision, &info->w_commit))
|
||||
return error(_("%s is not a valid reference"), revision);
|
||||
|
||||
assert_stash_like(info, revision);
|
||||
@ -216,7 +216,8 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
|
||||
end_of_rev = strchrnul(revision, '@');
|
||||
strbuf_add(&symbolic, revision, end_of_rev - revision);
|
||||
|
||||
ret = dwim_ref(symbolic.buf, symbolic.len, &dummy, &expanded_ref, 0);
|
||||
ret = repo_dwim_ref(the_repository, symbolic.buf, symbolic.len,
|
||||
&dummy, &expanded_ref, 0);
|
||||
strbuf_release(&symbolic);
|
||||
switch (ret) {
|
||||
case 0: /* Not found, but valid ref */
|
||||
@ -236,7 +237,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
|
||||
static int do_clear_stash(void)
|
||||
{
|
||||
struct object_id obj;
|
||||
if (get_oid(ref_stash, &obj))
|
||||
if (repo_get_oid(the_repository, ref_stash, &obj))
|
||||
return 0;
|
||||
|
||||
return delete_ref(NULL, ref_stash, &obj, 0);
|
||||
@ -432,7 +433,7 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)
|
||||
* to the index before a merge was run) and the current index
|
||||
* (reflecting the changes brought in by the merge).
|
||||
*/
|
||||
diff_setup(&diff_opts);
|
||||
repo_diff_setup(the_repository, &diff_opts);
|
||||
diff_opts.flags.recursive = 1;
|
||||
diff_opts.detect_rename = 0;
|
||||
diff_opts.output_format = DIFF_FORMAT_NO_OUTPUT;
|
||||
@ -605,7 +606,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
|
||||
ret = error(_("could not write index"));
|
||||
|
||||
if (ret) {
|
||||
rerere(0);
|
||||
repo_rerere(the_repository, 0);
|
||||
|
||||
if (index)
|
||||
fprintf_ln(stderr, _("Index was not unstashed."));
|
||||
@ -905,7 +906,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)
|
||||
|
||||
init_diff_ui_defaults();
|
||||
git_config(git_diff_ui_config, NULL);
|
||||
init_revisions(&rev, prefix);
|
||||
repo_init_revisions(the_repository, &rev, prefix);
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, git_stash_show_usage,
|
||||
PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT |
|
||||
@ -1088,13 +1089,13 @@ static int check_changes_tracked_files(const struct pathspec *ps)
|
||||
int ret = 0;
|
||||
|
||||
/* No initial commit. */
|
||||
if (get_oid("HEAD", &dummy))
|
||||
if (repo_get_oid(the_repository, "HEAD", &dummy))
|
||||
return -1;
|
||||
|
||||
if (repo_read_index(the_repository) < 0)
|
||||
return -1;
|
||||
|
||||
init_revisions(&rev, NULL);
|
||||
repo_init_revisions(the_repository, &rev, NULL);
|
||||
copy_pathspec(&rev.prune_data, ps);
|
||||
|
||||
rev.diffopt.flags.quick = 1;
|
||||
@ -1281,7 +1282,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
|
||||
struct strbuf diff_output = STRBUF_INIT;
|
||||
struct index_state istate = INDEX_STATE_INIT(the_repository);
|
||||
|
||||
init_revisions(&rev, NULL);
|
||||
repo_init_revisions(the_repository, &rev, NULL);
|
||||
copy_pathspec(&rev.prune_data, ps);
|
||||
|
||||
set_alternate_index_output(stash_index_path.buf);
|
||||
@ -1360,7 +1361,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (get_oid("HEAD", &info->b_commit)) {
|
||||
if (repo_get_oid(the_repository, "HEAD", &info->b_commit)) {
|
||||
if (!quiet)
|
||||
fprintf_ln(stderr, _("You do not have "
|
||||
"the initial commit yet"));
|
||||
@ -1378,8 +1379,9 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
|
||||
branch_ref = resolve_ref_unsafe("HEAD", 0, NULL, &flags);
|
||||
if (flags & REF_ISSYMREF)
|
||||
skip_prefix(branch_ref, "refs/heads/", &branch_name);
|
||||
head_short_sha1 = find_unique_abbrev(&head_commit->object.oid,
|
||||
DEFAULT_ABBREV);
|
||||
head_short_sha1 = repo_find_unique_abbrev(the_repository,
|
||||
&head_commit->object.oid,
|
||||
DEFAULT_ABBREV);
|
||||
strbuf_addf(&msg, "%s: %s ", branch_name, head_short_sha1);
|
||||
pp_commit_easy(CMIT_FMT_ONELINE, head_commit, &msg);
|
||||
|
||||
|
Reference in New Issue
Block a user