Skip to content

Unknown option 'rebase' error #1528

Description

@sgwilliams-ebsco

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!

Activity

  1. stsewd commented on Jan 3, 2023

    @stsewd
    Contributor

    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?
    
  2. sgwilliams-ebsco commented on Jan 3, 2023

    @sgwilliams-ebsco
    Author

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

  3. sgwilliams-ebsco commented on Jan 3, 2023

    @sgwilliams-ebsco
    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!

  4. Byron commented on Jan 4, 2023

    @Byron
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions