load_subtree(): remove unnecessary conditional

At this point in the code, len is *always* <= 20. 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 d3b0c6bebf3d8e85464b33d58e47a73894d882c7
1 file changed +17 -18
notes.c
+17 -18
@@ -446,25 +446,24 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
446 * If object SHA1 is incomplete (len < 20), and current
447 * component consists of 2 hex chars, assume note subtree
448 */
449 - if (len <= GIT_SHA1_RAWSZ) {
450 - type = PTR_TYPE_NOTE;
451 - l = (struct leaf_node *)
452 - xcalloc(1, sizeof(struct leaf_node));
453 - oidcpy(&l->key_oid, &object_oid);
454 - oidcpy(&l->val_oid, entry.oid);
455 - if (len < GIT_SHA1_RAWSZ) {
456 - if (!S_ISDIR(entry.mode) || path_len != 2)
457 - goto handle_non_note; /* not subtree */
458 - l->key_oid.hash[KEY_INDEX] = (unsigned char) len;
459 - type = PTR_TYPE_SUBTREE;
460 - }
461 - if (note_tree_insert(t, node, n, l, type,
462 - combine_notes_concatenate))
463 - die("Failed to load %s %s into notes tree "
464 - "from %s",
465 - type == PTR_TYPE_NOTE ? "note" : "subtree",
466 - oid_to_hex(&l->key_oid), t->ref);
449 + type = PTR_TYPE_NOTE;
450 + l = (struct leaf_node *)
451 + xcalloc(1, sizeof(struct leaf_node));
452 + oidcpy(&l->key_oid, &object_oid);
453 + oidcpy(&l->val_oid, entry.oid);
454 + if (len < GIT_SHA1_RAWSZ) {
455 + if (!S_ISDIR(entry.mode) || path_len != 2)
456 + goto handle_non_note; /* not subtree */
457 + l->key_oid.hash[KEY_INDEX] = (unsigned char) len;
458 + type = PTR_TYPE_SUBTREE;
459 }
460 + if (note_tree_insert(t, node, n, l, type,
461 + combine_notes_concatenate))
462 + die("Failed to load %s %s into notes tree "
463 + "from %s",
464 + type == PTR_TYPE_NOTE ? "note" : "subtree",
465 + oid_to_hex(&l->key_oid), t->ref);
466 +
467 continue;
468
469 handle_non_note: