Skip to content

Version: don't use default_branch when getting the commit name #10885

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

Closed
wants to merge 1 commit into from

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Nov 2, 2023

The name of the branch used is already in the version itself, we don't need to depend on the project's get_default_branch.

This doesn't work on the builders, because we use
the APIProject object, which doesn't have access to the DB nor has the remote_repository relationship in it.

if self.remote_repository and self.remote_repository.default_branch:
return self.remote_repository.default_branch

In cases where users have project.default_branh = None, this was returning master instead of the GitHub's default.

The name of the branch used is already in the version itself,
we don't need to depend on the project.

This doesn't work on the builders, because we use
the APIProject object, which doesn't have access to
the DB nor has the remote_repository relationship in it.

https://github.com/readthedocs/readthedocs.org/blob/fe7e976dbf989f1eee04368df3427086edfb89c9/readthedocs/projects/models.py#L1262-L1263
@stsewd stsewd requested a review from a team as a code owner November 2, 2023 16:40
@stsewd stsewd requested a review from humitos November 2, 2023 16:40
@stsewd
Copy link
Member Author

stsewd commented Nov 3, 2023

This isn't going to work, as we have an special case for latest's identifier being none.

@stsewd stsewd closed this Nov 3, 2023
@stsewd stsewd deleted the fix-commit-name branch November 3, 2023 02:57
@humitos
Copy link
Member

humitos commented Nov 7, 2023

This isn't going to work, as we have an special case for latest's identifier being none.

Every time we touch this code we break some particular use case. I know that you have been digging pretty deep into this lately, maybe it's worth to dump your knowledge into a page that documents the logic in our code for all the possible workflows. Maybe with that document, we can be all in the same page and avoid future breaking changes. Just an idea.

@stsewd
Copy link
Member Author

stsewd commented Nov 8, 2023

#10892 has a description about the special cases of the versions that I found. Having a single document describing the whole build process could be helpful 👍

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.

3 participants