File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -229,12 +229,13 @@ let generate_push_notification notification channel =
229
229
let { sender; created; deleted; forced; compare; commits; repository; _ } = notification in
230
230
let commits_branch = Github. commits_branch_of_ref notification.ref in
231
231
let tree_url = String. concat ~sep: " /" [ repository.url; " tree" ; Uri. pct_encode commits_branch ] in
232
+ let num_commits = List. length commits in
232
233
let title =
233
234
if deleted then
234
235
sprintf " <%s|[%s]> %s deleted branch <%s|%s>" tree_url repository.name sender.login compare commits_branch
235
236
else
236
237
sprintf " <%s|[%s:%s]> <%s|%i commit%s> %spushed %sby %s" tree_url repository.name commits_branch compare
237
- ( List. length commits)
238
+ num_commits
238
239
( match commits with
239
240
| [ _ ] -> " "
240
241
| _ -> " s"
@@ -244,9 +245,16 @@ let generate_push_notification notification channel =
244
245
sender.login
245
246
in
246
247
let commits =
247
- List. map commits ~f: ( fun { url; id; message; author; _ } ->
248
+ let pp_commit { url; id; message; author; _ } =
248
249
let title = first_line message in
249
- sprintf " `<%s|%s>` %s - %s" url (git_short_sha_hash id) title author.name)
250
+ sprintf " `<%s|%s>` %s - %s" url (git_short_sha_hash id) title author.name
251
+ in
252
+ (* truncation point depends on line length, but 10 lines seems okay for most cases *)
253
+ let num_dropped = 10 in
254
+ let dropped = num_commits - num_dropped in
255
+ if dropped > 0 then
256
+ List. rev_map_append (List. drop (List. rev commits) dropped) [ sprintf " +%d more..." dropped ] ~f: pp_commit
257
+ else List. map commits ~f: pp_commit
250
258
in
251
259
{
252
260
channel;
You can’t perform that action at this time.
0 commit comments