public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Eric Sunshine <sunshine@sunshineco•com>
Cc: Johan Herland <johan@herland•net>, Git List <git@vger•kernel.org>,
	Joachim Breitner <mail@joachim-breitner•de>,
	"Kyle J. McKay" <mackyle@gmail•com>
Subject: Re: [PATCH] notes: Disallow reusing non-blob as a note object
Date: Fri, 14 Feb 2014 08:19:44 -0800	[thread overview]
Message-ID: <xmqq7g8xk6ov.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAPig+cSQ12Ga4kEnNrspzru2F3p0jWb2i=1GRX84k0am5AA6Bw@mail.gmail.com> (Eric Sunshine's message of "Fri, 14 Feb 2014 10:19:22 -0500")

Eric Sunshine <sunshine@sunshineco•com> 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);

  reply	other threads:[~2014-02-14 16:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 17:23 git-note -C changes commit type? Joachim Breitner
2014-02-11 23:52 ` Johan Herland
2014-02-12  0:06   ` Junio C Hamano
2014-02-12  5:16     ` Kyle J. McKay
2014-02-12  9:50     ` Johan Herland
2014-02-12  9:54       ` [PATCH] notes: Disallow reusing non-blob as a note object Johan Herland
2014-02-14 15:19         ` Eric Sunshine
2014-02-14 16:19           ` Junio C Hamano [this message]
2014-02-12  8:53   ` git-note -C changes commit type? Joachim Breitner
2014-02-12 10:26     ` Johan Herland
2014-02-12 10:33       ` Joachim Breitner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq7g8xk6ov.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=johan@herland$(echo .)net \
    --cc=mackyle@gmail$(echo .)com \
    --cc=mail@joachim-breitner$(echo .)de \
    --cc=sunshine@sunshineco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox