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
This commit is contained in:
Junio C Hamano
2014-03-14 14:25:39 -07:00
2 changed files with 32 additions and 1 deletions

View 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);