Merge branch 'ew/empty-merge-with-dirty-index-maint' into ew/empty-merge-with-dirty-index

* ew/empty-merge-with-dirty-index-maint:
  merge-recursive: avoid incorporating uncommitted changes in a merge
  move index_has_changes() from builtin/am.c to merge.c for reuse
  t6044: recursive can silently incorporate dirty changes in a merge
This commit is contained in:
Junio C Hamano
2017-12-22 12:48:38 -08:00
5 changed files with 70 additions and 42 deletions

View File

@ -1952,6 +1952,13 @@ int merge_trees(struct merge_options *o,
}
if (oid_eq(&common->object.oid, &merge->object.oid)) {
struct strbuf sb = STRBUF_INIT;
if (index_has_changes(&sb)) {
err(o, _("Dirty index: cannot merge (dirty: %s)"),
sb.buf);
return 0;
}
output(o, 0, _("Already up to date!"));
*result = head;
return 1;