-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Import manually: No branches available for newly created project #9369
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
Comments
This happens since the repo doesn't have a branch named master, and it was imported manually. The sync of branches/tags happens after doing the clone/checkout, we could do the sync before doing the checkout, or do it if the checkout fails. |
Is there a workaround for this issue other than deleting the project and starting over (and setting the branch name this time)? It seems like #9424 is probably a fix, but I don't know when that will be live. |
@natefoo you can create a temporal branch named master, after that all the versions should appear (if they don't, try triggering a build for master) |
@stsewd that worked, thanks! |
You could add a way to edit the branch added when you import manually (after the project is done) |
@showierdata9978 you can consider the workaround above ⬆️ |
ye, IK i just said that as a possible fix! |
The underlying issue is that the empty dropdown is supposed to show a list of valid branches. But the list isn't populated when the initial default branch is unset and doesn't match |
maybe on import you could check if that branch exists, and if not show an error |
im trying to find the page for manual import, your codebase is just so dang huge |
i need to find where the user inputs the default branch, and check if that branch exists on the VCS |
@showierdata9978 YES! The codebase for Read the Docs is a big one and is based on a decade of careful crafting and fiffling by a lot of people, so you are always welcome to ask questions. Are you looking for a way to automatically fill in the branch name? I think that the approach taken has been to discover the default branch after creating the project if the branch name is left empty. However, since the default branch name isn't discovered correctly, this approach fails. To fix it, I think that #9424 needs to move forwards. @humitos would it be correct to assume that this issue will also be fixed by #9424? Let's note in any case that this issue is closely related to #9367 |
I was thinking of checking with the vcs provider to check if the branch
exists
…On Fri, Dec 16, 2022, 8:44 AM Benjamin Balder Bach ***@***.***> wrote:
@showierdata9978 <https://github.com/showierdata9978> YES! The codebase
for Read the Docs is a big one and is based on a decade of careful crafting
and fiffling by a lot of people, so you are always welcome to ask questions.
Are you looking for a way to automatically fill in the branch name? I
think that the approach taken has been to discover the default branch
*after* creating the project *if* the branch name is left empty.
However, since the default branch name isn't discovered correctly, this
approach fails. To fix it, I think that #9424
<#9424> needs to move
forwards.
@humitos <https://github.com/humitos> would it be correct to assume that
this issue will also be fixed by #9424
<#9424>?
Let's note in any case that this issue is closely related to #9367
<#9367>
—
Reply to this email directly, view it on GitHub
<#9369 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQHW4P6CRYMOGUKF4ZHVTW3WNR53TANCNFSM5ZQJ3VGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Where is the options attribute truly defined I would be able to make a fix if I knew that (The html specifically) |
Note: a quick fix is to just git clone, without a selected branch, then do git branch and show that to the user |
I think it sounds good to think of this as input validation. If a branch is specified, verify that it exists. If no branch is specified, automatically use the default branch. In any case, VCS actions have to happen server-side. I'm not sure if JS is relevant here, couldn't this be handled entirely in form validation? Using |
Ye, it could, js is relevant so I can trace it back lol
…On Fri, Dec 16, 2022, 9:06 AM Benjamin Balder Bach ***@***.***> wrote:
I think it sounds good to think of this as input validation. If a branch
is specified, verify that it exists. If no branch is specified,
automatically use the default branch.
In any case, VCS actions have to happen server-side. I'm not sure if JS is
relevant here, couldn't this be handled entirely in form validation?
Using git clone --depth 1 and then this method
<#9367 (comment)>
to get the default branch might work.
—
Reply to this email directly, view it on GitHub
<#9369 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQHW4P37O3FSAORJQDTMJCTWNSAORANCNFSM5ZQJ3VGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
why was this not used for validaion in the first place?
|
found where it needs to be addedd readthedocs.org/readthedocs/projects/views/private.py Lines 398 to 407 in af0d328
|
also just found this file, it could work as a spot to put the validator
|
ah, danget i cant use |
came up with this def __call__(self, vcs ,fourm):
branch = fourm.fields['default_branch']
project_url = fourm.fields['project_url']
branches = vcs.branches
# Cant optimise this as vcs.branches returns list[VCSVersion]
branch_exists = False
for remote_branch in branches:
if branch == remote_branch.verbose_name:
branch_exists = True
break
if not branch_exists:
raise ValidationError("Default branch not found in VCS")
return |
@showierdata9978 are you able to test your approach in a development environment? There is information available here: https://dev.readthedocs.io/en/latest/install.html |
i am not, i will be able to in ~2 hours as im not at home right now |
This issue was solved by #9424 and it's going to be deployed today. |
Details
If we create a new project, there are no branches immediately visible. This means that it isn't possible for the user to change the value of "Default branch" after creating a new project with a blank default branch -- which fails as described in #9367
Expected Result
A list of all branch names from public Github project should appear immediately when importing new projects manually.
Actual Result
No branch names 🥶
The text was updated successfully, but these errors were encountered: