Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

Commit 94d75c2

Browse files
lunnyappleboy
authored andcommitted
fix commit tree view when submodule file lost (#68)
1 parent a34a13d commit 94d75c2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

commit.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ func (c *Commit) GetSubModules() (*ObjectCache, error) {
235235

236236
entry, err := c.GetTreeEntryByPath(".gitmodules")
237237
if err != nil {
238+
if _, ok := err.(ErrNotExist); ok {
239+
return nil, nil
240+
}
238241
return nil, err
239242
}
240243
rd, err := entry.Blob().Data()
@@ -273,9 +276,11 @@ func (c *Commit) GetSubModule(entryname string) (*SubModule, error) {
273276
return nil, err
274277
}
275278

276-
module, has := modules.Get(entryname)
277-
if has {
278-
return module.(*SubModule), nil
279+
if modules != nil {
280+
module, has := modules.Get(entryname)
281+
if has {
282+
return module.(*SubModule), nil
283+
}
279284
}
280285
return nil, nil
281286
}

0 commit comments

Comments
 (0)