Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gitpython-developers/GitPython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: mmulich/GitPython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Aug 17, 2021

  1. Use the Git class type definition within Repo classmethods

    Allow the GitCommandWrapperType definition to be used within the Repo
    classmethods. This change follows the intended purpose as stated in
    the code, "Subclasses may easily bring in their own custom types by
    placing a constructor or type here."
    
    The usecase that prompted this change has to do with
    `GIT_SSH_COMMAND`. The goal is to setup a custom `Git` class with
    knowledge of the value, something like as follows
    
    ```python
    from git import Git as BaseGit, Repo as BaseRepo
    
    class Git(BaseGit):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            # For example, assign the SSH command using the current flask
            # app's configured setting.
            self.update_environment(GIT_SSH_COMMAND=current_app.config['GIT_SSH_COMMAND'])
    
    class Repo(BaseRepo):
        GitCommandWrapperType = _Git
    ```
    
    With this change, the above example will allow the developer to use
    `Repo.clone_from(...)` with the indended outcome. Otherwise the
    developer will have two differing result when using `Repo(...)` vs
    `Repo.clone_from(...)`.
    mmulich committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    fe5f8d5 View commit details
    Browse the repository at this point in the history
Loading