Re: [PATCH] notes: Disallow reusing non-blob as a note object

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

 



Eric Sunshine <sunshine@xxxxxxxxxxxxxx> writes:

>> +       if (type != OBJ_BLOB) {
>> +               free(buf);
>> +               die(_("Cannot read note data from non-blob object '%s'."), arg);
>
> The way this diagnostic is worded, it sound as if the 'read' failed
> rather than that the user specified an incorrect object type. Perhaps
> "Object is not a blob '%s'" or "Expected blob but '%s' has type '%s'"
> or something along those lines?

Yeah, sounds good.  You also need to say what expects a blob, too.
Perhaps something like this?

 builtin/notes.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builtin/notes.c b/builtin/notes.c
index c11d6e6..a16bc00 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -272,8 +272,10 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
 		die(_("Failed to read object '%s'."), arg);
 	}
 	if (type != OBJ_BLOB) {
+		struct msg_arg *msg = opt->value;
 		free(buf);
-		die(_("Cannot read note data from non-blob object '%s'."), arg);
+		die(_("The -%c option takes a blob, which '%s' is not.",
+		      msg->use_editor ? 'c' : 'C', arg));
 	}
 	strbuf_add(&(msg->buf), buf, len);
 	free(buf);
--
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]