From 69216bf72be2be4f8aa932324b3145d3f395cdc6 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 4 Dec 2014 20:32:44 -0500 Subject: for_each_reflog_ent_reverse: turn leftover check into assertion Our loop should always process all lines, even if we hit the beginning of the file. We have a conditional after the loop ends to double-check that there is nothing left and to process it. But this should never happen, and is a sign of a logic bug in the loop. Let's turn it into a BUG assertion. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'refs.c') diff --git a/refs.c b/refs.c index 8ed9aee93..a421d4321 100644 --- a/refs.c +++ b/refs.c @@ -3136,7 +3136,7 @@ int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn, void } if (!ret && sb.len) - ret = show_one_reflog_ent(&sb, fn, cb_data); + die("BUG: reverse reflog parser had leftover data"); fclose(logfp); strbuf_release(&sb); -- cgit v1.2.1