You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Make static methods that mirror the IGitService instance methods and use
either a real mef instance or a fake one to get at the instance methods.
Things are slightly broken getting a reference to IGitService - in real
life, it's not a service, it's an exported value, but in unit tests it's
treated as a service (because this stupid distinction between services
and exported values is stupid).
So, IGitService is nothing but a bunch of helper methods, and we want to
use it as an instance and not just static methods, so that we can bypass
hitting the filesystem and libgit2# methods in unit tests. Some bits
that need IGitService for realz are running in places where there's no
MEF.
Therefore, the only time where it really makes a difference when/how the
IGitService instance is created is in unit tests. When running for real,
it makes zero difference if the instance is coming from mef or if it's
just created on the spot, so that's what we're doing now.
/// Returns the URL of the remote named "origin" for the specified <see cref="repository"/>. If the repository
16
17
/// is null or no remote named origin exists, this method returns null
17
18
/// </summary>
18
19
/// <param name="repository">The repository to look at for the remote.</param>
19
-
/// <returns>A <see cref="UriString"/> representing the origin or null if none found.</returns>
20
+
/// <returns>Returns a <see cref="UriString"/> representing the uri of the "origin" remote normalized to a GitHub repository url or null if none found.</returns>
/// Probes for a git repository and if one is found, returns a <see cref="UriString"/> for the repository's
27
-
/// remote named "origin" if one is found
28
+
/// Returns a <see cref="UriString"/> representing the uri of the "origin" remote normalized to a GitHub repository url or null if none found.
29
+
/// </summary>
30
+
/// <param name="repository"></param>
31
+
/// <returns>Returns a <see cref="UriString"/> representing the uri of the "origin" remote normalized to a GitHub repository url or null if none found.</returns>
/// Probes for a git repository and if one is found, returns a normalized GitHub uri <see cref="UriString"/>
39
+
/// for the repository's remote named "origin" if one is found
28
40
/// </summary>
29
41
/// <remarks>
30
42
/// The lookup checks to see if the specified <paramref name="path"/> is a repository. If it's not, it then
31
43
/// walks up the parent directories until it either finds a repository, or reaches the root disk.
32
44
/// </remarks>
33
45
/// <param name="path">The path to start probing</param>
34
-
/// <returns>A <see cref="UriString"/> representing the origin or null if none found.</returns>
46
+
/// <returns>Returns a <see cref="UriString"/> representing the uri of the "origin" remote normalized to a GitHub repository url or null if none found.</returns>
35
47
publicUriStringGetUri(stringpath)
36
48
{
37
49
returnGetUri(GetRepo(path));
38
50
}
39
51
40
52
/// <summary>
41
-
/// Probes for a git repository and if one is found, returns a <see cref="UriString"/> for the repository's
42
-
/// remote named "origin" if one is found
53
+
/// Probes for a git repository and if one is found, returns a normalized GitHub uri <see cref="UriString"/>
54
+
/// for the repository's remote named "origin" if one is found
55
+
/// </summary>
56
+
/// <remarks>
57
+
/// The lookup checks to see if the specified <paramref name="path"/> is a repository. If it's not, it then
58
+
/// walks up the parent directories until it either finds a repository, or reaches the root disk.
59
+
/// </remarks>
60
+
/// <param name="path">The path to start probing</param>
61
+
/// <returns>Returns a <see cref="UriString"/> representing the uri of the "origin" remote normalized to a GitHub repository url or null if none found.</returns>
62
+
publicstaticUriStringGetUriFromPath(stringpath)
63
+
{
64
+
returnGitServiceHelper.GetUri(path);
65
+
}
66
+
67
+
/// <summary>
68
+
/// Probes for a git repository and if one is found, returns a normalized GitHub uri
69
+
/// <see cref="UriString"/> for the repository's remote named "origin" if one is found
43
70
/// </summary>
44
71
/// <remarks>
45
72
/// The lookup checks to see if the path specified by the RepositoryPath property of the specified
46
73
/// <see cref="repoInfo"/> is a repository. If it's not, it then walks up the parent directories until it
47
74
/// either finds a repository, or reaches the root disk.
48
75
/// </remarks>
49
76
/// <param name="repoInfo">The repository information containing the path to start probing</param>
50
-
/// <returns>A <see cref="UriString"/> representing the origin or null if none found.</returns>
77
+
/// <returns>Returns a <see cref="UriString"/> representing the uri of the "origin" remote normalized to a GitHub repository url or null if none found.</returns>
51
78
publicUriStringGetUri(IGitRepositoryInforepoInfo)
52
79
{
53
80
returnGetUri(GetRepo(repoInfo));
54
81
}
55
82
83
+
/// <summary>
84
+
/// Probes for a git repository and if one is found, returns a normalized GitHub uri
85
+
/// <see cref="UriString"/> for the repository's remote named "origin" if one is found
86
+
/// </summary>
87
+
/// <remarks>
88
+
/// The lookup checks to see if the path specified by the RepositoryPath property of the specified
89
+
/// <see cref="repoInfo"/> is a repository. If it's not, it then walks up the parent directories until it
90
+
/// either finds a repository, or reaches the root disk.
91
+
/// </remarks>
92
+
/// <param name="repoInfo">The repository information containing the path to start probing</param>
93
+
/// <returns>Returns a <see cref="UriString"/> representing the uri of the "origin" remote normalized to a GitHub repository url or null if none found.</returns>
0 commit comments