for-each-ref: always check stat_tracking_info()'s return value
[gitweb.git] / builtin / notes.c
index 2b24d059b509d28d587066440ed131ce2f85464f..39c8573cde00bc15e673ae549fcd0f22ea67d29f 100644 (file)
@@ -269,7 +269,11 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
                die(_("Failed to resolve '%s' as a valid ref."), arg);
        if (!(buf = read_sha1_file(object, &type, &len)) || !len) {
                free(buf);
-               die(_("Failed to read object '%s'."), arg);;
+               die(_("Failed to read object '%s'."), arg);
+       }
+       if (type != OBJ_BLOB) {
+               free(buf);
+               die(_("Cannot read note data from non-blob object '%s'."), arg);
        }
        strbuf_add(&(msg->buf), buf, len);
        free(buf);
@@ -935,7 +939,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
        int result;
        const char *override_notes_ref = NULL;
        struct option options[] = {
-               OPT_STRING(0, "ref", &override_notes_ref, N_("notes_ref"),
+               OPT_STRING(0, "ref", &override_notes_ref, N_("notes-ref"),
                           N_("use notes from <notes_ref>")),
                OPT_END()
        };