Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork941
Use the Git class type definition within Repo classmethods#1322
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Allow the GitCommandWrapperType definition to be used within the Repoclassmethods. This change follows the intended purpose as stated inthe code, "Subclasses may easily bring in their own custom types byplacing 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 withknowledge of the value, something like as follows```pythonfrom git import Git as BaseGit, Repo as BaseRepoclass 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 thedeveloper will have two differing result when using `Repo(...)` vs`Repo.clone_from(...)`.
I believe this could help address issues around confusing usage of an SSH key when using Thanks for having simple contribution instructions. |
Thanks a lot for the fix for this long-standing oversight, it's much appreciated! And thanks for the hint, I looked at the contribution guidelines and found it outdated, that's fixed now to hopefully further improve the experience. |
Uh oh!
There was an error while loading.Please reload this page.
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 customGit
class withknowledge of the value, something like as follows
With this change, the above example will allow the developer to use
Repo.clone_from(...)
with the intended outcome. Otherwise thedeveloper will have two differing result when using
Repo(...)
vsRepo.clone_from(...)
.