On Sun, Nov 09, 2014 at 01:05:31AM +0100, Manzur Mukhitdinov wrote: > When object is replaced with itself git shows unhelpful messages like(git log): > "fatal: replace depth too high for object <SHA1>" > > Prevents user from replacing object with itself(with test for checking > this case). I thought we already did this in the last round of git-replace patches, but it looks like we only did it for the newly added --edit and --graft cases, not "git replace X X". I think this is probably a good step. I've also considered that this should be another way of deleting the replacement, but I think we decided that was too magical. > diff --git a/builtin/replace.c b/builtin/replace.c > index 294b61b..b7e05ad 100644 > --- a/builtin/replace.c > +++ b/builtin/replace.c > @@ -186,6 +186,9 @@ static int replace_object(const char *object_ref, const char *replace_ref, int f > if (get_sha1(replace_ref, repl)) > die("Failed to resolve '%s' as a valid ref.", replace_ref); > > + if (!hashcmp(object, repl)) > + return error("new object is the same as the old one: '%s'", sha1_to_hex(object)); > + > return replace_object_sha1(object_ref, object, replace_ref, repl, force); I think all of the callers of replace_object_sha1 do this same check now. Can we just move the check into that function instead of adding another instance of it? -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html