diff options
author | Elijah Newren <newren@gmail.com> | 2018-07-01 01:24:56 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-07-03 20:13:18 (GMT) |
commit | 1b9fbefbe08ff2bbcbb8a6089867b32fca603eac (patch) | |
tree | 34cb866304417116c47b1ec2a34b8421d331323f /builtin | |
parent | cffbfad50d1f37aea03520dd8d8ea983bc57da02 (diff) | |
download | git-1b9fbefbe08ff2bbcbb8a6089867b32fca603eac.zip git-1b9fbefbe08ff2bbcbb8a6089867b32fca603eac.tar.gz git-1b9fbefbe08ff2bbcbb8a6089867b32fca603eac.tar.bz2 |
index_has_changes(): avoid assuming operating on the_index
Modify index_has_changes() to take a struct istate* instead of just
operating on the_index. This is only a partial conversion, though,
because we call do_diff_cache() which implicitly assumes work is to be
done on the_index. Ongoing work is being done elsewhere to do the
remainder of the conversion, and thus is not duplicated here. Instead,
a simple check is put in place until that work is complete.
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/am.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/am.c b/builtin/am.c index 1151b5c..2d80056 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1763,7 +1763,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, &sb)) { write_state_bool(state, "dirtyindex", 1); die(_("Dirty index: cannot apply patches (dirty: %s)"), sb.buf); } @@ -1820,7 +1820,7 @@ 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)) { say(state, stdout, _("No changes -- Patch already applied.")); goto next; } @@ -1878,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)) { 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.")); |