revision.c: reduce implicit dependency the_repository
[gitweb.git] / builtin / am.c
index 2c19e69f585a46330718ddea1c13a095cefe9d19..601570dbef383fd5a614f65eecf31eeab447fbc5 100644 (file)
@@ -1372,7 +1372,7 @@ static void write_commit_patch(const struct am_state *state, struct commit *comm
        FILE *fp;
 
        fp = xfopen(am_path(state, "patch"), "w");
-       init_revisions(&rev_info, NULL);
+       repo_init_revisions(the_repository, &rev_info, NULL);
        rev_info.diff = 1;
        rev_info.abbrev = 0;
        rev_info.disable_stdin = 1;
@@ -1407,7 +1407,7 @@ static void write_index_patch(const struct am_state *state)
                                   the_repository->hash_algo->empty_tree);
 
        fp = xfopen(am_path(state, "patch"), "w");
-       init_revisions(&rev_info, NULL);
+       repo_init_revisions(the_repository, &rev_info, NULL);
        rev_info.diff = 1;
        rev_info.disable_stdin = 1;
        rev_info.no_commit_id = 1;
@@ -1464,7 +1464,7 @@ static int run_apply(const struct am_state *state, const char *index_file)
        int force_apply = 0;
        int options = 0;
 
-       if (init_apply_state(&apply_state, NULL))
+       if (init_apply_state(&apply_state, the_repository, NULL))
                BUG("init_apply_state() failed");
 
        argv_array_push(&apply_opts, "apply");
@@ -1565,7 +1565,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
                struct rev_info rev_info;
                const char *diff_filter_str = "--diff-filter=AM";
 
-               init_revisions(&rev_info, NULL);
+               repo_init_revisions(the_repository, &rev_info, NULL);
                rev_info.diffopt.output_format = DIFF_FORMAT_NAME_STATUS;
                diff_opt_parse(&rev_info.diffopt, &diff_filter_str, 1, rev_info.prefix);
                add_pending_oid(&rev_info, "HEAD", &our_tree, 0);
@@ -1598,12 +1598,13 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
        o.branch1 = "HEAD";
        their_tree_name = xstrfmt("%.*s", linelen(state->msg), state->msg);
        o.branch2 = their_tree_name;
+       o.detect_directory_renames = 0;
 
        if (state->quiet)
                o.verbosity = 0;
 
        if (merge_recursive_generic(&o, &our_tree, &their_tree, 1, bases, &result)) {
-               rerere(state->allow_rerere_autoupdate);
+               repo_rerere(the_repository, state->allow_rerere_autoupdate);
                free(their_tree_name);
                return error(_("Failed to merge in the changes."));
        }
@@ -1898,7 +1899,7 @@ static void am_resolve(struct am_state *state)
                        goto next;
        }
 
-       rerere(0);
+       repo_rerere(the_repository, 0);
 
        do_commit(state);