@@ -27,28 +27,24 @@ let empty_attachment =
27
27
let base_attachment (repository : repository ) =
28
28
{ empty_attachment with footer = Some (sprintf " <%s|%s>" repository.url (escape_mrkdwn repository.full_name)) }
29
29
30
- let pp_file (file : file ) = sprintf " <%s|%s>" file.url (Mrkdwn. escape_mrkdwn file.filename)
31
-
32
30
let populate_commit repository (commit : api_commit ) =
33
- let ({ sha; commit; url; author; files; stats } : api_commit ) = commit in
34
- let get_files () = List. map files ~f: pp_file in
31
+ let ({ sha; commit; url; author; files; _ } : api_commit ) = commit in
35
32
let title =
36
33
sprintf " `<%s|%s>` *%s - %s*" url (Slack. git_short_sha_hash sha)
37
34
(escape_mrkdwn @@ first_line commit.message)
38
35
(escape_mrkdwn commit.author.name)
39
36
in
40
37
let num_change = List. length files in
41
- let changes =
42
- sprintf " %d %s with %d %s and %d %s:" num_change
43
- (Slack. pluralize " changed file" num_change " s" )
44
- stats.additions
45
- (Slack. pluralize " addition" stats.additions " s" )
46
- stats.deletions
47
- (Slack. pluralize " deletion" stats.deletions " s" )
38
+ let prefix_path =
39
+ List. map files ~f: (fun f -> f.filename)
40
+ |> Common. longest_common_prefix
41
+ |> String. split ~on: '/'
42
+ |> List. drop_last_exn
43
+ |> String. concat ~sep: " /"
48
44
in
49
- let files = get_files () |> String. concat ~sep: " \n " in
50
- let text = sprintf " %s\n %s\n %s " title changes files in
51
- let fallback = sprintf " [%s] %s - %s" (git_short_sha_hash sha) commit.message commit.author.name in
45
+ let changes = sprintf " %d changed %s in `%s/` " num_change ( Slack. pluralize " file " num_change " s " ) prefix_path in
46
+ let text = sprintf " %s\n %s" title changes in
47
+ let fallback = sprintf " [%s] %s - %s" (Slack. git_short_sha_hash sha) commit.message commit.author.name in
52
48
{
53
49
(base_attachment repository) with
54
50
author_name = Some author.login;
0 commit comments