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

Unknown option 'rebase' error #1528

Closed
sgwilliams-ebsco opened this issue Jan 3, 2023 · 4 comments
Closed

Unknown option 'rebase' error #1528

sgwilliams-ebsco opened this issue Jan 3, 2023 · 4 comments

Comments

@sgwilliams-ebsco
Copy link

Hello!

We have a project which uses GitPython to automate interacting with Git for GitOps based deployments. After the 3.1.30 release we started seeing an error in our integration tests:

failed on setup with "git.exc.GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git pull -v -- origin --rebase
  stderr: 'error: unknown option `rebase''"

We believe it was introduced with this PR.

The code that is failing is:

repository = _initialize_repository(working_directory, remote_repository_url, token)
repository.remotes['origin'].pull('--rebase')

Any help would be greatly appreciated!

@stsewd
Copy link
Contributor

stsewd commented Jan 3, 2023

Options should be passed as kwargs, the argument from pull() is a git reference (like a branch name).

haven't tested if this works

repository.remotes['origin'].pull(rebase='')  # or rebase=True?

@sgwilliams-ebsco
Copy link
Author

Thanks for the quick response! We'll test out the kwargs approach and report back.

@sgwilliams-ebsco
Copy link
Author

We've confirmed that

repository.remotes['origin'].pull(rebase='') 

and

repository.remotes['origin'].pull(rebase=True)

both work.

I wonder if this should have a been a bump to the major version since it changes the behavior of several of the core git methods. Admittedly, we were passing the options to the pull command incorrectly.

Anyway, our tests are passing again.

Thanks for the help!

@Byron
Copy link
Member

Byron commented Jan 4, 2023

I wonder if this should have a been a bump to the major version since it changes the behavior of several of the core git methods.

It's the trade-off between not causing surprises during automated upgrades and protecting unsuspecting uses of GitPython from harm. For critical fixes GitPython will typically choose a patch release even if these have the potential to break some users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants