Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix submodule info loading #4

Merged
merged 2 commits into from
Jan 14, 2016
Merged

Conversation

nanoant
Copy link
Contributor

@nanoant nanoant commented Jan 13, 2016

  • 1st commit - fixes regression causing no submodule info being loaded at all introduced in ebd9fb2
  • 2nd commit - do not fail in GetCommitsInfo with no .gitmodules, causing 500 internal error in Gogs

See commit descriptions for more details.

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.
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.
nanoant added a commit to nanoant/gogs that referenced this pull request Jan 13, 2016
This is fixup for ea375c0. The bug was not
visible because commit.RefUrl was always returning empty url due regression
described in gogs/git-module#4
@unknwon
Copy link
Member

unknwon commented Jan 14, 2016

Thank you!

unknwon added a commit that referenced this pull request Jan 14, 2016
@unknwon unknwon merged commit 1193908 into gogs:master Jan 14, 2016
strk pushed a commit to strk/git-module that referenced this pull request Nov 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants