fetch tests: add a tag to be deleted to the pruning tests
[gitweb.git] / merge-recursive.c
index 2ecf495cc2a4a6d4544b92db1d2a8c3c0cc36f87..0fc580d8ca97c77d436f3351993300d19acd1ccc 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 (!o->call_depth && 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;