|
3 | 3 | * |
4 | 4 | * Based on git-am.sh by Junio C Hamano. |
5 | 5 | */ |
| 6 | +#define USE_THE_INDEX_COMPATIBILITY_MACROS |
6 | 7 | #include "cache.h" |
7 | 8 | #include "config.h" |
8 | 9 | #include "builtin.h" |
@@ -511,7 +512,7 @@ static int copy_notes_for_rebase(const struct am_state *state) |
511 | 512 | } |
512 | 513 |
|
513 | 514 | finish: |
514 | | - finish_copy_notes_for_rewrite(c, msg); |
| 515 | + finish_copy_notes_for_rewrite(the_repository, c, msg); |
515 | 516 | fclose(fp); |
516 | 517 | strbuf_release(&sb); |
517 | 518 | return ret; |
@@ -1529,7 +1530,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa |
1529 | 1530 | * changes. |
1530 | 1531 | */ |
1531 | 1532 |
|
1532 | | - init_merge_options(&o); |
| 1533 | + init_merge_options(&o, the_repository); |
1533 | 1534 |
|
1534 | 1535 | o.branch1 = "HEAD"; |
1535 | 1536 | their_tree_name = xstrfmt("%.*s", linelen(state->msg), state->msg); |
@@ -1703,7 +1704,7 @@ static void am_run(struct am_state *state, int resume) |
1703 | 1704 |
|
1704 | 1705 | refresh_and_write_cache(); |
1705 | 1706 |
|
1706 | | - if (index_has_changes(&the_index, NULL, &sb)) { |
| 1707 | + if (repo_index_has_changes(the_repository, NULL, &sb)) { |
1707 | 1708 | write_state_bool(state, "dirtyindex", 1); |
1708 | 1709 | die(_("Dirty index: cannot apply patches (dirty: %s)"), sb.buf); |
1709 | 1710 | } |
@@ -1761,7 +1762,7 @@ static void am_run(struct am_state *state, int resume) |
1761 | 1762 | * the result may have produced the same tree as ours. |
1762 | 1763 | */ |
1763 | 1764 | if (!apply_status && |
1764 | | - !index_has_changes(&the_index, NULL, NULL)) { |
| 1765 | + !repo_index_has_changes(the_repository, NULL, NULL)) { |
1765 | 1766 | say(state, stdout, _("No changes -- Patch already applied.")); |
1766 | 1767 | goto next; |
1767 | 1768 | } |
@@ -1815,7 +1816,7 @@ static void am_resolve(struct am_state *state) |
1815 | 1816 |
|
1816 | 1817 | say(state, stdout, _("Applying: %.*s"), linelen(state->msg), state->msg); |
1817 | 1818 |
|
1818 | | - if (!index_has_changes(&the_index, NULL, NULL)) { |
| 1819 | + if (!repo_index_has_changes(the_repository, NULL, NULL)) { |
1819 | 1820 | printf_ln(_("No changes - did you forget to use 'git add'?\n" |
1820 | 1821 | "If there is nothing left to stage, chances are that something else\n" |
1821 | 1822 | "already introduced the same changes; you might want to skip this patch.")); |
@@ -2271,7 +2272,7 @@ int cmd_am(int argc, const char **argv, const char *prefix) |
2271 | 2272 | /* Ensure a valid committer ident can be constructed */ |
2272 | 2273 | git_committer_info(IDENT_STRICT); |
2273 | 2274 |
|
2274 | | - if (read_index_preload(&the_index, NULL, 0) < 0) |
| 2275 | + if (repo_read_index_preload(the_repository, NULL, 0) < 0) |
2275 | 2276 | die(_("failed to read the index")); |
2276 | 2277 |
|
2277 | 2278 | if (in_progress) { |
|
0 commit comments