disallow single-step scrolling beyond available commits in tog
diff --git a/tog/tog.c b/tog/tog.c
index bbec670..7f8c1b8 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -617,6 +617,9 @@ show_log_view(struct got_object_id *start_id, struct got_repository *repo)
break;
case 'j':
case KEY_DOWN:
+ nparents = num_parents(first_displayed_entry);
+ if (selected >= nparents - 1)
+ break;
if (selected < LINES - 1)
selected++;
if (selected < LINES - 1)