Skip to content

Commit d78e7ee

Browse files
committed
Fix regression causing no submodule info
This fixes regression introduced in ebd9fb2, that GetSubModules was always returning empty submodule info because c.submoduleCache != nil check was always true since parseCommitData was setting commit.submoduleCache = newObjectCache() so it was always not-nil. Now we initialize submoduleCache in first GetSubModules call, next call will return cached entries.
1 parent 081966e commit d78e7ee

File tree

2 files changed

+1
-1
lines changed

2 files changed

+1
-1
lines changed

commit.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func (c *Commit) GetSubModules() (*objectCache, error) {
195195
}
196196

197197
scanner := bufio.NewScanner(rd)
198+
c.submoduleCache = newObjectCache()
198199
var ismodule bool
199200
var path string
200201
for scanner.Scan() {

repo_commit.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ func (repo *Repository) GetTagCommitID(name string) (string, error) {
3636
// \n\n separate headers from message
3737
func parseCommitData(data []byte) (*Commit, error) {
3838
commit := new(Commit)
39-
commit.submoduleCache = newObjectCache()
4039
commit.parents = make([]sha1, 0, 1)
4140
// we now have the contents of the commit object. Let's investigate...
4241
nextline := 0

0 commit comments

Comments
 (0)