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:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user