summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-08-26 08:28:07 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-26 16:21:01 (GMT)
commit404321879585b392118c9f4c3c4c9e4ccd6ba09f (patch)
treed2d54656704bcf41d197f543bbea5b095c4ee136 /notes.c
parent4d589b87e857015b4f78e47353f87d4aa717b1a0 (diff)
downloadgit-404321879585b392118c9f4c3c4c9e4ccd6ba09f.zip
git-404321879585b392118c9f4c3c4c9e4ccd6ba09f.tar.gz
git-404321879585b392118c9f4c3c4c9e4ccd6ba09f.tar.bz2
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>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/notes.c b/notes.c
index 61a5001..8bca18e 100644
--- a/notes.c
+++ b/notes.c
@@ -437,6 +437,11 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
if (path_len == 2 * (GIT_SHA1_RAWSZ - prefix_len)) {
/* This is potentially the remainder of the SHA-1 */
+
+ if (!S_ISREG(entry.mode))
+ /* notes must be blobs */
+ goto handle_non_note;
+
if (get_oid_hex_segment(entry.path, path_len,
object_oid.hash + prefix_len,
GIT_SHA1_RAWSZ - prefix_len) < 0)