1616 ,fileName
1717 ,filePath AS fileRelativePath
1818 ,split (git_commit .author , ' <' )[0 ] AS author
19- ,split (split (git_commit .author , ' <' )[1 ], '>' )[0 ] AS authorEmail
20- ,git_commit .author AS authorFull
2119 ,max (git_commit .sha ) AS maxCommitSha
22- ,COUNT (DISTINCT git_commit .sha ) AS commitCount
20+ ,collect (DISTINCT git_commit .sha ) AS commitHashes
2321 ,date (max (git_commit .date )) AS lastCommitDate
24- ORDER BY filePath ASCENDING , commitCount DESCENDING
2522UNWIND pathElements AS pathElement
2623 WITH *
2724 ,coalesce (nullif (split (fileRelativePath , '/' + pathElement )[0 ], fileRelativePath ), '' ) AS parent
@@ -34,37 +31,29 @@ UNWIND pathElements AS pathElement
3431 ,split (parent , '/' )[- 1 ] AS directoryParentName
3532 ,size (split (directory , '/' )) AS directoryPathLength
3633 ,author
37- ,authorEmail
38- ,authorFull
39- ,count (DISTINCT fileRelativePath ) AS fileCount
34+ ,collect (DISTINCT fileRelativePath ) AS files
4035 ,max (date (fileCreatedAtTimestamp ) ) AS lastCreationDate
4136 ,max (date (fileLastModificationAtTimestamp )) AS lastModificationDate
42- ,sum ( commitCount ) AS commitCount
37+ ,apoc . coll . toSet ( apoc . coll . flatten ( collect ( commitHashes ))) AS commitHashes
4338 ,max (maxCommitSha ) AS maxCommitSha
4439 ,max (lastCommitDate ) AS lastCommitDate
4540 ,max (fileRelativePath ) AS maxFileRelativePath
4641 ,duration .inDays (max (lastCommitDate ), date ()).days AS daysSinceLastCommit
4742 ,duration .inDays (max (fileCreatedAtTimestamp ), datetime ()).days AS daysSinceLastCreation
4843 ,duration .inDays (max (fileLastModificationAtTimestamp ), datetime ()).days AS daysSinceLastModification
4944// 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
5146 WITH directoryPath
5247 ,directoryName
5348 ,directoryParentPath
5449 ,directoryParentName
5550 ,directoryPathLength
5651 ,collect (author )[0 ] AS mainAuthor
57- ,collect (authorEmail )[0 ] AS mainAuthorEmail
58- ,collect (authorFull )[0 ] AS mainAuthorFull
5952 ,collect (author )[1 ] AS secondAuthor
60- ,collect (authorEmail )[1 ] AS secondAuthorEmail
61- ,collect (authorFull )[1 ] AS secondAuthorFull
6253 ,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
6857 ,max (lastCreationDate ) AS lastCreationDate
6958 ,max (lastModificationDate ) AS lastModificationDate
7059 ,max (maxCommitSha ) AS maxCommitSha
@@ -79,14 +68,8 @@ RETURN collect(directoryPath)[-1] AS directoryPath
7968 ,collect (directoryParentPath )[0 ] AS directoryParentPath
8069 ,collect (directoryParentName )[0 ] AS directoryParentName
8170 ,mainAuthor
82- ,mainAuthorEmail
83- ,mainAuthorFull
8471 ,secondAuthor
85- ,secondAuthorEmail
86- ,secondAuthorFull
8772 ,thirdAuthor
88- ,thirdAuthorEmail
89- ,thirdAuthorFull
9073 ,authorCount
9174 ,fileCount
9275 ,commitCount
0 commit comments