summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-08-02 22:30:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-08-02 22:30:45 (GMT)
commitc18ac30e9ebcf7b7e2fbd992744e63c71089a12a (patch)
tree5eb5c1185b0d8bce39356abd801f0a9d7bf802ab /builtin
parent2b9afea37207323d629953c639542c0e4c87e484 (diff)
parent55f39cf7551bd468065306328efdb78933b36b69 (diff)
downloadgit-c18ac30e9ebcf7b7e2fbd992744e63c71089a12a.zip
git-c18ac30e9ebcf7b7e2fbd992744e63c71089a12a.tar.gz
git-c18ac30e9ebcf7b7e2fbd992744e63c71089a12a.tar.bz2
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')
-rw-r--r--builtin/am.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/am.c b/builtin/am.c
index b6eeb46..2c19e69 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."));