Skip to content

Commit baa2356

Browse files
committed
Verify missing Git:File property createdAtEpoch
1 parent e3cbe9d commit baa2356

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

cypher/GitLog/List_git_file_directories_with_commit_statistics.cypher

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
WHERE git_file.deletedAt IS NULL // filter out deleted files
55
ORDER BY git_file.relativePath
66
WITH *
7-
,datetime.fromepochMillis(git_file.createdAtEpoch) AS fileCreatedAtTimestamp
7+
,datetime.fromepochMillis(coalesce(git_file.createdAtEpoch, 0)) AS fileCreatedAtTimestamp
88
,datetime.fromepochMillis(coalesce(git_file.lastModificationAtEpoch, git_file.createdAtEpoch)) AS fileLastModificationAtTimestamp
99
WITH *, git_repository.name + '/' + git_file.relativePath AS filePath
1010
WITH *, split(filePath, '/') AS pathElements
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Verify that git to code file relationships aren't ambiguous
2+
3+
MATCH (git_repository:Git&Repository)-[:HAS_FILE]->(git_file:Git&File&!Repository)
4+
WHERE git_file.deletedAt IS NULL // Ignore deleted git files
5+
AND git_file.createdAtEpoch IS NULL
6+
RETURN count(DISTINCT git_file) AS numberOfMissingCreateDateEntires

scripts/importGit.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-"source"} # Get the source repository direc
1717
IMPORT_DIRECTORY=${IMPORT_DIRECTORY:-"import"}
1818
IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT=${IMPORT_GIT_LOG_DATA_IF_SOURCE_IS_PRESENT:-"plugin"} # Select how to import git log data. Options: "none", "aggregated", "full" and "plugin". Default="plugin".
1919

20+
# Local constants
21+
COLOR_YELLOW='\033[0;33m'
22+
COLOR_DEFAULT='\033[0m'
23+
2024
# Default and initial values for command line options
2125
source="${SOURCE_DIRECTORY}"
2226

@@ -136,6 +140,15 @@ commonPostGitImport() {
136140
execute_cypher "${GIT_LOG_CYPHER_DIR}/Verify_git_to_code_file_unambiguous.cypher"
137141
execute_cypher "${GIT_LOG_CYPHER_DIR}/Verify_code_to_git_file_unambiguous.cypher"
138142
execute_cypher "${GIT_LOG_CYPHER_DIR}/Verify_git_missing_CHANGED_TOGETHER_WITH_properties.cypher"
143+
144+
dataVerificationResult=$( execute_cypher "${GIT_LOG_CYPHER_DIR}/Verify_git_missing_create_date.cypher")
145+
if ! is_csv_column_greater_zero "${dataVerificationResult}" "numberOfMissingCreateDateEntires"; then
146+
# Warning: The git file creation date must not be missing. However, this is not important enough to stop the analysis.
147+
# Therefore, it will only be a warning and subsequent queries will use a default date in these cases.
148+
echo -e "${COLOR_YELLOW}importGit: Data verification warning: Git:File nodes with missing createdAtEpoch property detected! Affected number of nodes:${COLOR_DEFAULT}"
149+
echo -e "${COLOR_YELLOW}${dataVerificationResult}${COLOR_DEFAULT}"
150+
# Since this is now only a warning, execution will be continued.
151+
fi
139152
}
140153

141154
postGitLogImport() {

0 commit comments

Comments
 (0)