From: Christian Couder Date: Sun, 25 Aug 2013 19:44:17 GMT Subject: Re: [PATCH 1/5] replace: forbid replacing an object with one of a different type Message-ID: <20130825.214417.1308749312477487067.chriscool@tuxfamily.org> In-Reply-To: <521A4E83.9000400@kdbg.org> From: Johannes Sixt > Am 25.08.2013 15:06, schrieb Christian Couder: >> @@ -100,6 +101,15 @@ static int replace_object(const char *object_ref, const char *replace_ref, >> if (check_refname_format(ref, 0)) >> die("'%s' is not a valid ref name.", ref); >> >> + obj_type = sha1_object_info(object, NULL); >> + repl_type = sha1_object_info(repl, NULL); >> + if (obj_type != repl_type) >> + die("Objects must be of the same type.\n" >> + "Object ref '%s' is of type '%s'\n" > > Is it really an "Object ref", not just an "Object"? Well, it is what is passed to the command line. It is then converted into an hex sha1 using get_sha1() and then sha1_to_hex(). What about: die("Objects must be of the same type.\n" "'%s' points to a replaced object of type '%s'\n" "while '%s' points to a replacement object of type '%s'.", > BTW, I appreciate your choice of where in the sentence the line breaks are. Thanks, Christian.