summaryrefslogtreecommitdiffstats
path: root/builtin/replace.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/replace.c')
-rw-r--r--builtin/replace.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/replace.c b/builtin/replace.c
index 3da1bae0a6..0751804039 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -275,6 +275,9 @@ static int edit_and_replace(const char *object_ref, int force)
free(tmpfile);
+ if (!hashcmp(old, new))
+ return error("new object is the same as the old one: '%s'", sha1_to_hex(old));
+
return replace_object_sha1(object_ref, old, "replacement", new, force);
}