load_subtree(): only consider blobs to be potential notes
The old code converted any entry whose path constituted a full SHA-1 as a leaf node, without regard for the type of the entry. But only blobs can be notes. So treat entries whose paths *look like* notes paths but that are not blobs as non-notes. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Aug 26, 2017 at 10:28 UTC
404321879585b392118c9f4c3c4c9e4ccd6ba09f
1 file changed
+5
notes.c
+5
@@ -437,6 +437,11 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
437
438
if (path_len == 2 * (GIT_SHA1_RAWSZ - prefix_len)) {
439
/* This is potentially the remainder of the SHA-1 */
440
+
441
+ if (!S_ISREG(entry.mode))
442
+ /* notes must be blobs */
443
+ goto handle_non_note;
444
+
445
if (get_oid_hex_segment(entry.path, path_len,
446
object_oid.hash + prefix_len,
447
GIT_SHA1_RAWSZ - prefix_len) < 0)