stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

fix [Bug]: Extension update check issue #6447

Open sswam opened this issue 1 year ago • 2 comments

Describe what this pull request is trying to achieve.

One line patch to fix a bug that has recurred: Extension update check issue #6447

Additional notes and description of your changes

This code: repo.remote().fetch("--dry-run") produces this git command: git fetch -v -- origin --dry-run Gives an error: fatal: couldn't find remote ref --dry-run

The corrected code: repo.remote().fetch(dry_run=True) produces this git command: git fetch -v --dry-run -- origin Which does not cause an error.

This seems to be due to a change in GitPython 3.1.31 vs 3.1.27, but the correction using a kwarg is a better way to do it I guess.

We can reproduce the bug outside the webui, like this:

# pip install GitPython==3.1.31

Old code, causes an error:

# python -c 'import git; git.Repo(".").remote().fetch("--dry-run")'
...
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'

New code, no error:

# python -c 'import git; git.Repo(".").remote().fetch(dry_run=True)

Showing that kwarg options are passed through to the git command line:

# python -c 'import git; git.Repo(".").remote().fetch(bogus=True)'
...
git.exc.GitCommandError: Cmd('git') failed due to: exit code(129)
  cmdline: git fetch -v --bogus -- origin
  stderr: 'error: unknown option `bogus''

Environment this was tested in

List the environment you have developed / tested this on. As per the contributing page, changes should be able to work on Windows out of the box.

  • OS: Debian Linux
  • Browser: Chrome
  • Graphics card: NVIDIA RTX 3090
  • Python 3.10.10
  • git version 2.39.2
  • GitPython 3.1.31

I also tested it with the older GitPython that is specified in requirements_versions.txt:

  • GitPython 3.1.27

I didn't test it on Windows, but I don't think that it can break anything on Windows.

sswam avatar Mar 02 '23 05:03 sswam

Duplicate of #8118 which is more extensive

skittlz444 avatar Mar 02 '23 08:03 skittlz444

extension:dreambooth uses the gitpython==3.1.31, change the requirements.txt in extension:dreambooth as gitpython==3.1.27 can fix bug

Kotori05 avatar Mar 09 '23 05:03 Kotori05