Commit Diff


commit - f4425f95a55d6c26f06ecef7b3b8aa6a4a4247de
commit + 0a2fc48663670b6fb1a778aafc653227c9103442
blob - aba5a591662378d9b7363a6435d153408a11fb87
blob + b0b81d728aae26ca8ade03729c3738e50a573ac3
--- gotwebd/got_operations.c
+++ gotwebd/got_operations.c
@@ -311,7 +311,7 @@ got_get_repo_commit(struct request *c, struct repo_com
 }
 
 const struct got_error *
-got_get_repo_commits(struct request *c, int limit)
+got_get_repo_commits(struct request *c, size_t limit)
 {
 	const struct got_error *error = NULL;
 	struct got_object_id *id = NULL;
@@ -328,7 +328,10 @@ got_get_repo_commits(struct request *c, int limit)
 	char *in_repo_path = NULL, *repo_path = NULL, *file_path = NULL;
 	int chk_next = 0;
 
-	if (limit != 1 || srv->max_commits_display == 1) {
+	if (limit == 0)
+		return got_error(GOT_ERR_RANGE);
+
+	if (limit > 1) {
 		/*
 		 * Traverse one commit more than requested to provide
 		 * the next button.
blob - fae082679ec712db36cb01d56e5edb5857535ab7
blob + 057b25c7ef680bcd1c7f35556e2adaa42ed3da38
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
@@ -509,7 +509,7 @@ const struct got_error *got_gotweb_closefile(FILE *);
 const struct got_error *got_get_repo_owner(char **, struct request *);
 const struct got_error *got_get_repo_age(time_t *, struct request *,
     const char *);
-const struct got_error *got_get_repo_commits(struct request *, int);
+const struct got_error *got_get_repo_commits(struct request *, size_t);
 const struct got_error *got_get_repo_tags(struct request *, int);
 const struct got_error *got_get_repo_heads(struct request *);
 const struct got_error *got_open_diff_for_output(FILE **, struct request *);