Skip to content

Commit 69216bf

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e5e73ff commit 69216bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

refs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3136,7 +3136,7 @@ int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn, void
31363136

31373137
}
31383138
if (!ret && sb.len)
3139-
ret = show_one_reflog_ent(&sb, fn, cb_data);
3139+
die("BUG: reverse reflog parser had leftover data");
31403140

31413141
fclose(logfp);
31423142
strbuf_release(&sb);

0 commit comments

Comments
 (0)