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/notes.c | |
parent | c923f603ea9288a8d44da994d9d0b4aea220dc99 (diff) | |
parent | ce8daa1eb863c9cdefb06feae2ee7c742ea89847 (diff) | |
download | git-b37f81b7b676fe7ede3fa171535593337a8911c8.tar.gz git-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/notes.c')
-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 2b24d059b..bb8993037 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); |