-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Use "real" GitUICommands instance #11927
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK but I prefer a better naming because I'm a bit lost in namings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
(I wonder why most of us could not reproduce the exception.)
private readonly IRepositoryHostPlugin _gitHoster; | ||
private readonly EventHandler<GitModuleEventArgs>? _gitModuleChanged; | ||
|
||
public ForkAndCloneForm(IRepositoryHostPlugin gitHoster, EventHandler<GitModuleEventArgs>? gitModuleChanged) | ||
public ForkAndCloneForm(IGitUICommands commands, IRepositoryHostPlugin gitHoster, EventHandler<GitModuleEventArgs>? gitModuleChanged) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public ForkAndCloneForm(IGitUICommands commands, IRepositoryHostPlugin gitHoster, EventHandler<GitModuleEventArgs>? gitModuleChanged) | |
public ForkAndCloneForm(IServiceProvider serviceProvider, IRepositoryHostPlugin gitHoster, EventHandler<GitModuleEventArgs>? gitModuleChanged) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't do this for the forms, only for controls. I haven't given this too much thought, but on the surface it's probably a good change to make across the codebase.
@@ -370,11 +372,9 @@ private void Clone(IHostedRepository repo) | |||
return; | |||
} | |||
|
|||
GitUICommands uiCommands = new(GitUICommands.EmptyServiceProvider, new GitModule(null)); | |||
ArgumentString cmd = Commands.Clone(repo.CloneUrl, targetDir, _commands.Module.GetPathForGitExecution, depth: GetDepth()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArgumentString cmd = Commands.Clone(repo.CloneUrl, targetDir, _commands.Module.GetPathForGitExecution, depth: GetDepth()); | |
GitUICommands uiCommands = new(_serviceProvider, new GitModule(null)); |
@@ -1302,7 +1302,7 @@ public void StartCloneForkFromHoster(IWin32Window? owner, IRepositoryHostPlugin | |||
{ | |||
WrapRepoHostingCall(TranslatedStrings.ForkCloneRepo, gitHoster, gh => | |||
{ | |||
using ForkAndCloneForm frm = new(gh, gitModuleChanged); | |||
using ForkAndCloneForm frm = new(this, gh, gitModuleChanged); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using ForkAndCloneForm frm = new(this, gh, gitModuleChanged); | |
using ForkAndCloneForm frm = new(serviceProvider: this, gh, gitModuleChanged); |
I was about (I worked on it and diagnosed the issue but I had to stop working on it and so was slower than @RussKie to propose the fix) |
Resolves #11906
Test methodology
Test environment(s)
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.