Files
git/builtin
Johan Herland ce8daa1eb8 notes: disallow reusing non-blob as a note object
Currently "git notes add -C $object" will read the raw bytes from $object,
and then copy those bytes into the note object, which is hardcoded to be
of type blob. This means that if the given $object is a non-blob (e.g.
tree or commit), the raw bytes from that object is copied into a blob
object. This is probably not useful, and certainly not what any sane
user would expect. So disallow it, by erroring out if the $object passed
to the -C option is not a blob.

The fix also applies to the -c option (in which the user is prompted to
edit/verify the note contents in a text editor), and also when -c/-C is
passed to "git notes append" (which appends the $object contents to an
existing note object). In both cases, passing a non-blob $object does not
make sense.

Also add a couple of tests demonstrating expected behavior.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-02-20 14:14:33 -08:00
..
2013-07-22 11:23:10 -07:00
2013-07-22 11:34:25 -07:00
2013-06-02 16:00:44 -07:00
2013-04-15 11:04:44 -07:00
2013-05-29 14:23:40 -07:00
2013-08-01 11:52:37 -07:00
2013-07-22 11:24:09 -07:00
2013-07-29 12:32:25 -07:00
2013-08-28 16:55:23 -07:00
2013-07-22 11:24:11 -07:00
2013-07-29 12:32:25 -07:00
2013-05-29 14:23:04 -07:00
2013-06-17 13:30:01 -07:00
2013-07-19 09:26:15 -07:00
2013-07-22 11:23:56 -07:00