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 extention update when not on main branch #15797

Merged
merged 1 commit into from
Jun 8, 2024

Conversation

w-e-w
Copy link
Collaborator

@w-e-w w-e-w commented May 15, 2024

Description

issue

I consider this issue to be quite severe, even though it doesn't currently impact normal users only advanced users and developers

currently if a user is using a branch of extension that is not the main branch
there will be an issue when they try to update the extension

in the check_updates code()
it checks for origin = repo.rev_parse('origin') whitch is the commit hash of the main branch and not the hash of the branch where the user is on

and later on when confirming the update fetch_and_reset_hard() will reset the extention repo to the commit of the main branch and Not the branch the usere is on

for normal users who never switches branches this is fine they should never encounter this issue

but for advanced users who knows how to use git that are deliberately on a different branch this would cause their extension to be hard reste the the master branch

or in development phase, where devs are working on a separate branch the could have there code accidentally hard reset (data loss) to

in the future is possible some extensions might decide to maintain different version compatibility in different branches

if user is using a branch of extension that is not the main branch
the user will be reseted to the main branch

this will also prevent extensions from maintaining compatibility for different versions on different branches
as it will be reset the the main branch

fix solution

repo.rev_parse(f'{repo.remote().name}/{self.branch}') when checking for update
and repo.git.reset(f'{repo.remote().name}/{self.branch}', hard=True) when applying the update


I have done my test and seems to work correctly
but if someone should probably verify again that I haven't screwed up

Checklist:

@w-e-w w-e-w requested a review from AUTOMATIC1111 as a code owner May 15, 2024 08:41
@AUTOMATIC1111 AUTOMATIC1111 merged commit 7b940e3 into dev Jun 8, 2024
6 checks passed
@AUTOMATIC1111 AUTOMATIC1111 deleted the fix-extention-update-when-not-on-main-branch branch June 8, 2024 08:19
@lawchingman lawchingman mentioned this pull request Oct 5, 2024
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.

2 participants