Skip to content

Commit d18ad23

Browse files
committed
try to fix Duplicate of files in directory (gogs#2254 )
gogs/gogs#2254
1 parent 9dc84c9 commit d18ad23

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tree_entry.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func (tes Entries) Sort() {
110110

111111
type commitInfo struct {
112112
id string
113+
entry string
113114
infos []interface{}
114115
err error
115116
}
@@ -128,7 +129,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
128129
for i := range tes {
129130
if tes[i].Type != OBJECT_COMMIT {
130131
go func(i int) {
131-
cinfo := commitInfo{id: tes[i].ID.String()}
132+
cinfo := commitInfo{id: tes[i].ID.String(), entry: tes[i].Name()}
132133
c, err := commit.GetCommitByPath(filepath.Join(treePath, tes[i].Name()))
133134
if err != nil {
134135
cinfo.err = fmt.Errorf("GetCommitByPath (%s/%s): %v", treePath, tes[i].Name(), err)
@@ -142,7 +143,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
142143

143144
// Handle submodule
144145
go func(i int) {
145-
cinfo := commitInfo{id: tes[i].ID.String()}
146+
cinfo := commitInfo{id: tes[i].ID.String(), entry: tes[i].Name()}
146147
sm, err := commit.GetSubModule(path.Join(treePath, tes[i].Name()))
147148
if err != nil {
148149
cinfo.err = fmt.Errorf("GetSubModule (%s/%s): %v", treePath, tes[i].Name(), err)
@@ -171,7 +172,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
171172
return nil, info.err
172173
}
173174

174-
infoMap[info.id] = info.infos
175+
infoMap[info.entry] = info.infos
175176
i++
176177
if i == len(tes) {
177178
break
@@ -180,7 +181,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
180181

181182
commitsInfo := make([][]interface{}, len(tes))
182183
for i := 0; i < len(tes); i++ {
183-
commitsInfo[i] = infoMap[tes[i].ID.String()]
184+
commitsInfo[i] = infoMap[tes[i].Name()]
184185
}
185186
return commitsInfo, nil
186187
}

0 commit comments

Comments
 (0)