diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-03-14 14:25:39 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-03-14 14:25:39 -0700 |
commit | b37f81b7b676fe7ede3fa171535593337a8911c8 (patch) | |
tree | 56a6ed44d2331628297494b92999ec8f0bf89d59 /builtin | |
parent | Merge branch 'rt/links-for-asciidoctor' (diff) | |
parent | notes: disallow reusing non-blob as a note object (diff) | |
download | tgif-b37f81b7b676fe7ede3fa171535593337a8911c8.tar.xz |
Merge branch 'jh/note-trees-record-blobs'
"git notes -C <blob>" should not take an object that is not a blob.
* jh/note-trees-record-blobs:
notes: disallow reusing non-blob as a note object
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/notes.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/notes.c b/builtin/notes.c index 2b24d059b5..bb89930373 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -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); |