16
16
,fileName
17
17
,filePath AS fileRelativePath
18
18
,split (git_commit .author , ' <' )[0 ] AS author
19
- ,split (split (git_commit .author , ' <' )[1 ], '>' )[0 ] AS authorEmail
20
- ,git_commit .author AS authorFull
21
19
,max (git_commit .sha ) AS maxCommitSha
22
- ,COUNT (DISTINCT git_commit .sha ) AS commitCount
20
+ ,collect (DISTINCT git_commit .sha ) AS commitHashes
23
21
,date (max (git_commit .date )) AS lastCommitDate
24
- ORDER BY filePath ASCENDING , commitCount DESCENDING
25
22
UNWIND pathElements AS pathElement
26
23
WITH *
27
24
,coalesce (nullif (split (fileRelativePath , '/' + pathElement )[0 ], fileRelativePath ), '' ) AS parent
@@ -34,37 +31,29 @@ UNWIND pathElements AS pathElement
34
31
,split (parent , '/' )[- 1 ] AS directoryParentName
35
32
,size (split (directory , '/' )) AS directoryPathLength
36
33
,author
37
- ,authorEmail
38
- ,authorFull
39
- ,count (DISTINCT fileRelativePath ) AS fileCount
34
+ ,collect (DISTINCT fileRelativePath ) AS files
40
35
,max (date (fileCreatedAtTimestamp ) ) AS lastCreationDate
41
36
,max (date (fileLastModificationAtTimestamp )) AS lastModificationDate
42
- ,sum ( commitCount ) AS commitCount
37
+ ,apoc . coll . toSet ( apoc . coll . flatten ( collect ( commitHashes ))) AS commitHashes
43
38
,max (maxCommitSha ) AS maxCommitSha
44
39
,max (lastCommitDate ) AS lastCommitDate
45
40
,max (fileRelativePath ) AS maxFileRelativePath
46
41
,duration .inDays (max (lastCommitDate ), date ()).days AS daysSinceLastCommit
47
42
,duration .inDays (max (fileCreatedAtTimestamp ), datetime ()).days AS daysSinceLastCreation
48
43
,duration .inDays (max (fileLastModificationAtTimestamp ), datetime ()).days AS daysSinceLastModification
49
44
// Assure that the authors are ordered by their commit count descending per directory
50
- ORDER BY directoryPath ASCENDING , commitCount DESCENDING
45
+ ORDER BY directoryPath ASCENDING , size ( commitHashes ) DESCENDING
51
46
WITH directoryPath
52
47
,directoryName
53
48
,directoryParentPath
54
49
,directoryParentName
55
50
,directoryPathLength
56
51
,collect (author )[0 ] AS mainAuthor
57
- ,collect (authorEmail )[0 ] AS mainAuthorEmail
58
- ,collect (authorFull )[0 ] AS mainAuthorFull
59
52
,collect (author )[1 ] AS secondAuthor
60
- ,collect (authorEmail )[1 ] AS secondAuthorEmail
61
- ,collect (authorFull )[1 ] AS secondAuthorFull
62
53
,collect (author )[2 ] AS thirdAuthor
63
- ,collect (authorEmail )[2 ] AS thirdAuthorEmail
64
- ,collect (authorFull )[2 ] AS thirdAuthorFull
65
- ,count (DISTINCT authorFull ) AS authorCount
66
- ,sum (fileCount ) AS fileCount
67
- ,sum (commitCount ) AS commitCount
54
+ ,count (DISTINCT author ) AS authorCount
55
+ ,size (apoc .coll .toSet (apoc .coll .flatten (collect (files )))) AS fileCount
56
+ ,size (apoc .coll .toSet (apoc .coll .flatten (collect (commitHashes )))) AS commitCount
68
57
,max (lastCreationDate ) AS lastCreationDate
69
58
,max (lastModificationDate ) AS lastModificationDate
70
59
,max (maxCommitSha ) AS maxCommitSha
@@ -79,14 +68,8 @@ RETURN collect(directoryPath)[-1] AS directoryPath
79
68
,collect (directoryParentPath )[0 ] AS directoryParentPath
80
69
,collect (directoryParentName )[0 ] AS directoryParentName
81
70
,mainAuthor
82
- ,mainAuthorEmail
83
- ,mainAuthorFull
84
71
,secondAuthor
85
- ,secondAuthorEmail
86
- ,secondAuthorFull
87
72
,thirdAuthor
88
- ,thirdAuthorEmail
89
- ,thirdAuthorFull
90
73
,authorCount
91
74
,fileCount
92
75
,commitCount
0 commit comments