Git 2.16-rc1
[gitweb.git] / merge-recursive.c
index 2ecf495cc2a4a6d4544b92db1d2a8c3c0cc36f87..780f81a8bd3a729502cf2211a63135e4fba5d6cf 100644 (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;