Unverified Commit aee611ad authored by AUTOMATIC1111's avatar AUTOMATIC1111 Committed by GitHub
Browse files

Merge pull request #4646 from mrauhu/force-update-extensions

Fix: `error: Your local changes to the following files would be overwritten by merge` when trying to update extensions in WSL2 Docker
parents 5bfef6e0 d671d1d4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -65,9 +65,12 @@ class Extension:
        self.can_update = False
        self.status = "latest"

    def pull(self):
    def fetch_and_reset_hard(self):
        repo = git.Repo(self.path)
        repo.remotes.origin.pull()
        # Fix: `error: Your local changes to the following files would be overwritten by merge`,
        # because WSL2 Docker set 755 file permissions instead of 644, this results to the error.
        repo.git.fetch('--all')
        repo.git.reset('--hard', 'origin')


def list_extensions():
+2 −2
Original line number Diff line number Diff line
@@ -36,9 +36,9 @@ def apply_and_restart(disable_list, update_list):
            continue

        try:
            ext.pull()
            ext.fetch_and_reset_hard()
        except Exception:
            print(f"Error pulling updates for {ext.name}:", file=sys.stderr)
            print(f"Error getting updates for {ext.name}:", file=sys.stderr)
            print(traceback.format_exc(), file=sys.stderr)

    shared.opts.disabled_extensions = disabled