apply.c: make init_apply_state() take a struct repository
[gitweb.git] / builtin / am.c
index b6eeb46c4b65aefbc83b25d11d2ea28646990137..9f7ecf6ecb7711c35277fa827c4c2afc0dfba867 100644 (file)
@@ -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");
@@ -1766,7 +1766,7 @@ static void am_run(struct am_state *state, int resume)
 
        refresh_and_write_cache();
 
-       if (index_has_changes(&sb)) {
+       if (index_has_changes(&the_index, NULL, &sb)) {
                write_state_bool(state, "dirtyindex", 1);
                die(_("Dirty index: cannot apply patches (dirty: %s)"), sb.buf);
        }
@@ -1823,7 +1823,8 @@ static void am_run(struct am_state *state, int resume)
                         * Applying the patch to an earlier tree and merging
                         * the result may have produced the same tree as ours.
                         */
-                       if (!apply_status && !index_has_changes(NULL)) {
+                       if (!apply_status &&
+                           !index_has_changes(&the_index, NULL, NULL)) {
                                say(state, stdout, _("No changes -- Patch already applied."));
                                goto next;
                        }
@@ -1877,7 +1878,7 @@ static void am_resolve(struct am_state *state)
 
        say(state, stdout, _("Applying: %.*s"), linelen(state->msg), state->msg);
 
-       if (!index_has_changes(NULL)) {
+       if (!index_has_changes(&the_index, NULL, NULL)) {
                printf_ln(_("No changes - did you forget to use 'git add'?\n"
                        "If there is nothing left to stage, chances are that something else\n"
                        "already introduced the same changes; you might want to skip this patch."));