Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
[Bug]: GitPython breaking API change in 3.1.30, breaks extension updates
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

[Per this PR](https://github.com/gitpython-developers/GitPython/pull/1518) and [the changelog](https://github.com/gitpython-developers/GitPython/pull/1518) you can no longer feed arbitrary arguments to prevent remote code execution.

Easy fix, just use the built kwarg that's already there for it.
https://github.com/AUTOMATIC1111/stable-diffusion-webui/blame/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8/modules/extensions.py#LL69C28-L69C28

there may be other places in the code as well, I'll take a peek

### Steps to reproduce the problem

1. `pip install 'gitpython>=3.1.30'
2. run the web-ui and try to install/check for updates while watching terminal

### What should have happened?

Should have successfully run the git commands and updated  the git repos

### Commit where the problem happens

0cc0ee1b

### What platforms do you use to access the UI ?

Windows

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

```Shell
No
```


### List of extensions

No

### Console logs

```Shell
Traceback (most recent call last):
  File "/mnt/d/stable-diffusion/stable-diffusion-webui/modules/ui_extensions.py", line 66, in check_updates
    ext.check_updates()
  File "/mnt/d/stable-diffusion/stable-diffusion-webui/modules/extensions.py", line 69, in check_updates
    for fetch in repo.remote().fetch("--dry-run"):
  File "/home/adam/.cache/pypoetry/virtualenvs/sd-deps-z4SYejYZ-py3.10/lib/python3.10/site-packages/git/remote.py", line 1007, in fetch
    res = self._get_fetch_info_from_stderr(proc, progress, kill_after_timeout=kill_after_timeout)
  File "/home/adam/.cache/pypoetry/virtualenvs/sd-deps-z4SYejYZ-py3.10/lib/python3.10/site-packages/git/remote.py", line 848, in _get_fetch_info_from_stderr
    proc.wait(stderr=stderr_text)
  File "/home/adam/.cache/pypoetry/virtualenvs/sd-deps-z4SYejYZ-py3.10/lib/python3.10/site-packages/git/cmd.py", line 604, in wait
    raise GitCommandError(remove_password_if_present(self.args), status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git fetch -v -- origin --dry-run
  stderr: 'fatal: couldn't find remote ref --dry-run'
```


### Additional information

_No response_


Discussion:

Resolving patch:
diff --git a/modules/extensions.py b/modules/extensions.py
--- a/modules/extensions.py
+++ b/modules/extensions.py
@@ -66,7 +66,7 @@ def list_files(self, subdir, extension):
 
     def check_updates(self):
         repo = git.Repo(self.path)
-        for fetch in repo.remote().fetch("--dry-run"):
+        for fetch in repo.remote().fetch(dry_run=True):
             if fetch.flags != fetch.HEAD_UPTODATE:
                 self.can_update = True
                 self.status = "behind"
@@ -79,8 +79,8 @@ def fetch_and_reset_hard(self):
         repo = git.Repo(self.path)
         # 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')
+        repo.git.fetch(all=True)
+        repo.git.reset('origin', hard=True)
 
 
 def list_extensions():


Test patch: