-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Use IGitModule
in signatures
#11269
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
Use IGitModule
in signatures
#11269
Conversation
GitCommands/Config/ConfigFile.cs
Outdated
@@ -4,7 +4,7 @@ | |||
|
|||
namespace GitCommands.Config | |||
{ | |||
public class ConfigFile | |||
public class ConfigFile : ISubmodulesConfigFile |
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.
❓ I read this as "Every config file is a submodules config file". This feels wrong.
The interface ISubmodulesConfigFile
does not contain anything submodule-specific at a first glance.
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.
It is the data in .gitmodules
The interface needs some comments...
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.
I have added IConfigFile: ISubmodulesConfigFile
and synchronized the method name GetSubmodulesConfigFile
with the interface name in c3418e3 (after resolving the MC).
This comment was marked as resolved.
This comment was marked as resolved.
This PR is about removing direct use of I found (and keep finding) implementations in |
4354a2d
to
90ed824
Compare
GitUI/CommandsDialogs/FormClone.cs
Outdated
CancellationToken cancellationToken = _branchLoaderSequence.Next(); | ||
ThreadHelper.JoinableTaskFactory.RunAsync(async () => | ||
{ | ||
await TaskScheduler.Default; | ||
|
||
RemoteActionResult<IReadOnlyList<IGitRef>> branchList; | ||
|
||
IReadOnlyList<IGitRef> refs = Module.GetRemoteServerRefs(from, false, true, out string? errorOutput, cancellationToken); | ||
|
||
if (string.IsNullOrEmpty(errorOutput)) | ||
{ | ||
branchList = new(result: refs, authenticationFail: false, hostKeyFail: false); | ||
} | ||
else if (errorOutput.Contains("FATAL ERROR") && errorOutput.Contains("authentication")) | ||
{ | ||
// If the authentication failed because of a missing key, ask the user to supply one. | ||
branchList = new(result: null, authenticationFail: true, hostKeyFail: false); | ||
} | ||
else if (errorOutput.Contains("the server's host key is not cached in the registry", StringComparison.InvariantCultureIgnoreCase)) | ||
{ | ||
branchList = new(result: null, authenticationFail: false, hostKeyFail: true); | ||
} | ||
else | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
await this.SwitchToMainThreadAsync(cancellationToken); | ||
if (!cancellationToken.IsCancellationRequested) | ||
{ | ||
UpdateBranches(branchList); | ||
} | ||
}).FileAndForget(); |
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.
Moved the implementation from GitModule
.
I believe this is largely ready for review and for being taken in. |
Friendly ping @gerhardol @mstv @pmiossec |
This comment was marked as resolved.
This comment was marked as resolved.
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.
I need to continue the review of the middle commit "Compile" yet.
No comments on the first and third commits.
GitCommands/Config/ConfigFile.cs
Outdated
@@ -4,7 +4,7 @@ | |||
|
|||
namespace GitCommands.Config | |||
{ | |||
public class ConfigFile | |||
public class ConfigFile : ISubmodulesConfigFile |
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.
I have added IConfigFile: ISubmodulesConfigFile
and synchronized the method name GetSubmodulesConfigFile
with the interface name in c3418e3 (after resolving the MC).
that return the checked out branch or the commit hash if detached HEAD. + a little less misleading help + Invert `GetSelectedBranch()` boolean param logic from `setDefaultIfEmpty` to `emptyIfDetached`
7eef38d
to
cf5b521
Compare
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.
I force pushed by mistake because I forgot to update the tracking reference.
All good |
cf5b521
to
e5e5e38
Compare
@mstv I believe I address the feedback. Thank you for your reviews. |
e5e5e38
to
2b1ad24
Compare
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.
+1 only brief review
4d754ac
to
7773123
Compare
still MC |
I won't be able to look at it until tomorrow
|
7773123
to
be47ed9
Compare
Thank you @mstv for rebasing this and getting the build green again. Is there anything else outstanding that I missed? Or can we get this merged? |
fine for me |
Proposed changes
This PR removes the direct dependency on the concrete implementation of
GitModule
and replaces all callsites with theIGitModule
interface. The change is somewhat crude to made the code compile.IGitModule
interface has been updated with the required signature (almost) without any consideration on the quality of the API it provides.This PR is about setting the foundation for using the abstractions, and the follow up work will concentrate on individual aspects such as
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.