diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-02 15:30:45 -0700 |
commit | c18ac30e9ebcf7b7e2fbd992744e63c71089a12a (patch) | |
tree | 5eb5c1185b0d8bce39356abd801f0a9d7bf802ab /builtin/am.c | |
parent | Merge branch 'js/rebase-merge-octopus' (diff) | |
parent | merge: fix misleading pre-merge check documentation (diff) | |
download | tgif-c18ac30e9ebcf7b7e2fbd992744e63c71089a12a.tar.xz |
Merge branch 'en/dirty-merge-fixes'
The recursive merge strategy did not properly ensure there was no
change between HEAD and the index before performing its operation,
which has been corrected.
* en/dirty-merge-fixes:
merge: fix misleading pre-merge check documentation
merge-recursive: enforce rule that index matches head before merging
t6044: add more testcases with staged changes before a merge is invoked
merge-recursive: fix assumption that head tree being merged is HEAD
merge-recursive: make sure when we say we abort that we actually abort
t6044: add a testcase for index matching head, when head doesn't match HEAD
t6044: verify that merges expected to abort actually abort
index_has_changes(): avoid assuming operating on the_index
read-cache.c: move index_has_changes() from merge.c
Diffstat (limited to 'builtin/am.c')
-rw-r--r-- | builtin/am.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/am.c b/builtin/am.c index b6eeb46c4b..2c19e69f58 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -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.")); |