Skip to content

Commit 2617983

Browse files
committed
Merge pull request #3 from novaeye/patch-1
try to fix Duplicate of files in directory (gogs#2254 )
2 parents 9dc84c9 + c7a2974 commit 2617983

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tree_entry.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ func (tes Entries) Sort() {
109109
}
110110

111111
type commitInfo struct {
112-
id string
113-
infos []interface{}
114-
err error
112+
entryName string
113+
infos []interface{}
114+
err error
115115
}
116116

117117
// GetCommitsInfo takes advantages of concurrey to speed up getting information
@@ -128,7 +128,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
128128
for i := range tes {
129129
if tes[i].Type != OBJECT_COMMIT {
130130
go func(i int) {
131-
cinfo := commitInfo{id: tes[i].ID.String()}
131+
cinfo := commitInfo{entryName: tes[i].Name()}
132132
c, err := commit.GetCommitByPath(filepath.Join(treePath, tes[i].Name()))
133133
if err != nil {
134134
cinfo.err = fmt.Errorf("GetCommitByPath (%s/%s): %v", treePath, tes[i].Name(), err)
@@ -142,7 +142,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
142142

143143
// Handle submodule
144144
go func(i int) {
145-
cinfo := commitInfo{id: tes[i].ID.String()}
145+
cinfo := commitInfo{entryName: tes[i].Name()}
146146
sm, err := commit.GetSubModule(path.Join(treePath, tes[i].Name()))
147147
if err != nil {
148148
cinfo.err = fmt.Errorf("GetSubModule (%s/%s): %v", treePath, tes[i].Name(), err)
@@ -171,7 +171,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
171171
return nil, info.err
172172
}
173173

174-
infoMap[info.id] = info.infos
174+
infoMap[info.entryName] = info.infos
175175
i++
176176
if i == len(tes) {
177177
break
@@ -180,7 +180,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
180180

181181
commitsInfo := make([][]interface{}, len(tes))
182182
for i := 0; i < len(tes); i++ {
183-
commitsInfo[i] = infoMap[tes[i].ID.String()]
183+
commitsInfo[i] = infoMap[tes[i].Name()]
184184
}
185185
return commitsInfo, nil
186186
}

0 commit comments

Comments
 (0)