summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2017-08-26 08:28:02 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-26 16:21:01 (GMT)
commitd3b0c6bebf3d8e85464b33d58e47a73894d882c7 (patch)
treecfb9d012ca07fa76656cf983c5dbabdea1785c55 /notes.c
parent65eb8e0ca79d4a58768f9409b24c48a95d39bc55 (diff)
downloadgit-d3b0c6bebf3d8e85464b33d58e47a73894d882c7.zip
git-d3b0c6bebf3d8e85464b33d58e47a73894d882c7.tar.gz
git-d3b0c6bebf3d8e85464b33d58e47a73894d882c7.tar.bz2
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>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/notes.c b/notes.c
index 71cc664..a8b9371 100644
--- a/notes.c
+++ b/notes.c
@@ -446,25 +446,24 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
* If object SHA1 is incomplete (len < 20), and current
* component consists of 2 hex chars, assume note subtree
*/
- if (len <= GIT_SHA1_RAWSZ) {
- type = PTR_TYPE_NOTE;
- l = (struct leaf_node *)
- xcalloc(1, sizeof(struct leaf_node));
- oidcpy(&l->key_oid, &object_oid);
- oidcpy(&l->val_oid, entry.oid);
- if (len < GIT_SHA1_RAWSZ) {
- if (!S_ISDIR(entry.mode) || path_len != 2)
- goto handle_non_note; /* not subtree */
- l->key_oid.hash[KEY_INDEX] = (unsigned char) len;
- type = PTR_TYPE_SUBTREE;
- }
- if (note_tree_insert(t, node, n, l, type,
- combine_notes_concatenate))
- die("Failed to load %s %s into notes tree "
- "from %s",
- type == PTR_TYPE_NOTE ? "note" : "subtree",
- oid_to_hex(&l->key_oid), t->ref);
+ type = PTR_TYPE_NOTE;
+ l = (struct leaf_node *)
+ xcalloc(1, sizeof(struct leaf_node));
+ oidcpy(&l->key_oid, &object_oid);
+ oidcpy(&l->val_oid, entry.oid);
+ if (len < GIT_SHA1_RAWSZ) {
+ if (!S_ISDIR(entry.mode) || path_len != 2)
+ goto handle_non_note; /* not subtree */
+ l->key_oid.hash[KEY_INDEX] = (unsigned char) len;
+ type = PTR_TYPE_SUBTREE;
}
+ if (note_tree_insert(t, node, n, l, type,
+ combine_notes_concatenate))
+ die("Failed to load %s %s into notes tree "
+ "from %s",
+ type == PTR_TYPE_NOTE ? "note" : "subtree",
+ oid_to_hex(&l->key_oid), t->ref);
+
continue;
handle_non_note: