Skip to content

Commit 919a66d

Browse files
committed
Do not fail in GetCommitsInfo with no .gitmodules
This fixes GetCommitsInfo returning GetSubModule (/somemodule): object does not exist [id: , rel_path: .gitmodules] when /somemodule is a ref entry but no .gitmodules file is present. Instead failing we just check for IsErrNotExist and return empty submodule url. This also fixes HTTP 500 internal error in Gogs for case described above.
1 parent d78e7ee commit 919a66d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tree_entry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (tes Entries) GetCommitsInfo(commit *Commit, treePath string) ([][]interfac
144144
go func(i int) {
145145
cinfo := commitInfo{entryName: tes[i].Name()}
146146
sm, err := commit.GetSubModule(path.Join(treePath, tes[i].Name()))
147-
if err != nil {
147+
if err != nil && !IsErrNotExist(err) {
148148
cinfo.err = fmt.Errorf("GetSubModule (%s/%s): %v", treePath, tes[i].Name(), err)
149149
revChan <- cinfo
150150
return

0 commit comments

Comments
 (0)