tree_entry: fix CommitsInfo messed up with entries have the same SHA1 #59
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
to fix gogs/gogs#6186
to fix gogs/gogs#6235
to fix gogs/gogs#6240
The problem is on git-module
git-module/tree_entry.go
Lines 261 to 270 in cf0a6d7
An entry id is not unique so it should not be used as map key. When on a tree there is a file or folder with same contents its SHA1 hash is equal. This can be tested in any repo with two files with same content executing
git ls-tree HEAD
Maybe a solution is using name as the key as I bet entry name is unique in any tree.
Or maybe just including entry index on info so later only one loop is needed to fill commitsInfo.