[PATCH 07/12] load_subtree(): only consider blobs to be potential notes
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Aug 26, 2017, 08:28 UTC
- Message-ID
- <f57e3132fcb98b1a9f36b07886d3620bd224e377.1503734566.git.mhagger@alum.mit.edu>
- In-Reply-To
- <cover.1503734566.git.mhagger@alum.mit.edu>
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> --- notes.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/notes.c b/notes.c index ac69c5aa18..46ab15b83a 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)
-- 2.11.0