Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Ungureanu <marius.ungureanu@xamarin.com>2015-08-17 20:24:21 +0300
committerMarius Ungureanu <marius.ungureanu@xamarin.com>2015-08-17 20:25:17 +0300
commit13f33098c2726372f17c05f3e5f5c47e958355ba (patch)
treefac3dcbd35a90b0178604982356dfd3f63065de4 /main/src/addins/VersionControl
parent504505f1eaa512d4bfddd82308c1b80c2266a7fc (diff)
[VCS] Clarify intent of repository detection heuristics
Rename the `shortestPath` variable to `bestMatch` and change the comment regarding what this variable contains.
Diffstat (limited to 'main/src/addins/VersionControl')
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs16
1 files changed, 8 insertions, 8 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
index 800859dc81..69764a4bfd 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
@@ -210,26 +210,26 @@ namespace MonoDevelop.VersionControl
return repo;
}
-
+
public static Repository GetRepositoryReference (string path, string id)
{
VersionControlSystem detectedVCS = null;
- FilePath shortestPath = FilePath.Null;
+ FilePath bestMatch = FilePath.Null;
foreach (VersionControlSystem vcs in GetVersionControlSystems ()) {
var newPath = vcs.GetRepositoryPath (path, id);
if (!newPath.IsNullOrEmpty) {
- if (string.IsNullOrEmpty (shortestPath)) {
- shortestPath = newPath;
+ // Check whether we have no match or if a new match is found with a longer path.
+ if (bestMatch.IsNullOrEmpty) {
+ bestMatch = newPath;
detectedVCS = vcs;
- } else if (shortestPath.CompareTo (newPath) <= 0) {
- // They are guaranteed to be on the same path segments, so choose by path length.
- shortestPath = newPath;
+ } else if (bestMatch.CompareTo (newPath) <= 0) {
+ bestMatch = newPath;
detectedVCS = vcs;
}
}
}
- return detectedVCS == null ? null : detectedVCS.GetRepositoryReference (shortestPath, id);
+ return detectedVCS == null ? null : detectedVCS.GetRepositoryReference (bestMatch, id);
}