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 [Bug]: Extension update check issue #6447 #8245

Closed
wants to merge 1 commit into from

Conversation

sswam
Copy link

@sswam sswam commented Mar 2, 2023

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 sswam requested a review from AUTOMATIC1111 as a code owner March 2, 2023 05:27
@skittlz444
Copy link

Duplicate of #8118 which is more extensive

@Kotori05
Copy link

Kotori05 commented Mar 9, 2023

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

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.

4 participants