Fix: return correct type in GetSubModule
- `GetSubModules` already solely stores the URL of the submodule and not a `*SubModule` entry, so don't try to type assert it to be a struct. - I am not able to pinpoint when this was regressed but if I had to guess it might be #4941. - Added integration test.
This commit is contained in:
parent
fe246cc060
commit
e7cffc378f
4 changed files with 46 additions and 12 deletions
|
@ -395,20 +395,20 @@ func parseSubmoduleContent(bs []byte) (*ObjectCache, error) {
|
|||
return submoduleCache, nil
|
||||
}
|
||||
|
||||
// GetSubModule get the sub module according entryname
|
||||
func (c *Commit) GetSubModule(entryname string) (*SubModule, error) {
|
||||
// GetSubModule returns the URL to the submodule according entryname
|
||||
func (c *Commit) GetSubModule(entryname string) (string, error) {
|
||||
modules, err := c.GetSubModules()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
if modules != nil {
|
||||
module, has := modules.Get(entryname)
|
||||
if has {
|
||||
return module.(*SubModule), nil
|
||||
return module.(string), nil
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// GetBranchName gets the closest branch name (as returned by 'git name-rev --name-only')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue