Re: [PATCH v5 1/7] replace: forbid replacing an object with one of a different type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christian Couder <chriscool@xxxxxxxxxxxxx> 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)
--
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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]