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 multiple readme file rendering and fix #1657 #1658

Merged
merged 2 commits into from
May 2, 2017

Conversation

lunny
Copy link
Member

@lunny lunny commented May 2, 2017

will fix #1657

@lunny lunny added the type/bug label May 2, 2017
@lunny lunny added this to the 1.2.0 milestone May 2, 2017
continue
}

// TODO: collect all possible README files and show with priority.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was in the TODO list. 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This PR will finish the TODO.

if readmeFile != nil {
if len(readmes) > 0 {
var readmeFile *git.Blob
for _, readme := range readmes {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why re-loop if we stop at first ok. This could be done directly in the first loop at https://github.com/lunny/gitea/blob/d0ddef4e095a8f4e317a6163cb2e955fea254779/routers/repo/view.go#L67 for example ?

This just add an additional test if the file is a good filetype so no need to save them in an array ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that this add another point that it default to even "bad filetype" if not one good is found.
But this could be implemented directly in the first loop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example in first loop setting directly readmeFile and do directly after

			if tp != "" {
				break
			}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sapk you are right. The type will check which parser could read the README file according ext name. But we also need support README, which should be rendered as a TEXT, so the tp may be empty. But README or README.diskdefine is lower priority than README.md or README.org(this will be implemented at #1527).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@sapk
Copy link
Member

sapk commented May 2, 2017

LGTM

@tboerger tboerger added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 2, 2017
@appleboy
Copy link
Member

appleboy commented May 2, 2017

LGTM

@tboerger tboerger added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 2, 2017
@appleboy appleboy merged commit 0d1e001 into go-gitea:master May 2, 2017
@lunny lunny deleted the lunny/fix_multi_readme branch May 2, 2017 09:00
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

README.md not displaying
4 participants