Christian Couder [off-list ref] writes:
+ obj_type = sha1_object_info(object, NULL);
+ repl_type = sha1_object_info(repl, NULL);
That we can do this is somewhat curious. If an object is replaced
with a different one, would it mean that this code snippet is
totally bogus?
type1 = sha1_object_info(sha1, &size1);
area = xmalloc(size1);
orig = read_sha1_file(sha1, &type0, &size0);
memcpy(area, orig, size1);
free(orig);
+ if (!force && obj_type != repl_type)
+ 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'.",
+ object_ref, typename(obj_type),
+ replace_ref, typename(repl_type));
+
if (read_ref(ref, prev))
hashclr(prev);
else if (!force)