You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/15 03:00:02 UTC

[GitHub] [incubator-devlake] mappjzc commented on a diff in pull request #3062: Commit file

mappjzc commented on code in PR #3062:
URL: https://github.com/apache/incubator-devlake/pull/3062#discussion_r971476180


##########
plugins/gitextractor/parser/repo.go:
##########
@@ -329,15 +332,20 @@ func (r *GitRepo) storeCommitFilesFromDiff(commitSha string, diff *git.Diff, com
 		commitFile = new(code.CommitFile)
 		commitFile.CommitSha = commitSha
 		commitFile.FilePath = file.NewFile.Path
-		commitFile.Id = commitSha + ":" + file.NewFile.Path
+
+		// use commitSha and the sha256 of FilePath to create id
+		shaFilePath := sha256.New()
+		shaFilePath.Write([]byte(file.NewFile.Path))
+		commitFile.Id = commitSha + ":" + hex.EncodeToString(shaFilePath.Sum(nil))

Review Comment:
   Because of issue https://github.com/apache/incubator-devlake/issues/2949
   With some long path,the varchar(255) was not enough both ID and file_path
   So we use the hash to compress the path in ID and add length of file_path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org