diff mbox series

[07/26] blame: remove needless comparison with GIT_SHA1_HEXSZ

Message ID 20190818200427.870753-8-sandals@crustytoothpaste.net (mailing list archive)
State New, archived
Headers show
Series object_id part 17 | expand

Commit Message

brian m. carlson Aug. 18, 2019, 8:04 p.m. UTC
When faking a working tree commit, we read in lines from MERGE_HEAD into
a strbuf.  Because the strbuf is NUL-terminated and get_oid_hex will
fail if it unexpectedly encounters a NUL, the check for the length of
the line is unnecessary.  There is no optimization benefit from this
case, either, since on failure we call die.  Remove this check, since it
is no longer needed.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
---
 blame.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/blame.c b/blame.c
index 36a2e7ef11..6596d8de88 100644
--- a/blame.c
+++ b/blame.c
@@ -144,7 +144,7 @@  static void append_merge_parents(struct repository *r,
 
 	while (!strbuf_getwholeline_fd(&line, merge_head, '\n')) {
 		struct object_id oid;
-		if (line.len < GIT_SHA1_HEXSZ || get_oid_hex(line.buf, &oid))
+		if (get_oid_hex(line.buf, &oid))
 			die("unknown line in '%s': %s",
 			    git_path_merge_head(r), line.buf);
 		tail = append_parent(r, tail, &oid);