summaryrefslogtreecommitdiff
path: root/builtin/notes.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-14 21:25:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-14 21:25:39 (GMT)
commitb37f81b7b676fe7ede3fa171535593337a8911c8 (patch)
tree56a6ed44d2331628297494b92999ec8f0bf89d59 /builtin/notes.c
parentc923f603ea9288a8d44da994d9d0b4aea220dc99 (diff)
parentce8daa1eb863c9cdefb06feae2ee7c742ea89847 (diff)
downloadgit-b37f81b7b676fe7ede3fa171535593337a8911c8.zip
git-b37f81b7b676fe7ede3fa171535593337a8911c8.tar.gz
git-b37f81b7b676fe7ede3fa171535593337a8911c8.tar.bz2
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.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/notes.c b/builtin/notes.c
index 2b24d05..bb89930 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);