Permalink
Browse files

Modified directory handling

Modified:
 - The directory handling for finding the .git folder has been changed so
   there isn't a false positive.
  • Loading branch information...
1 parent f921d40 commit f5b497acb3df80dd1cb56e180ec2a8cd88f3464b @nufyoot nufyoot committed May 16, 2012
Showing with 6 additions and 3 deletions.
  1. +6 −3 SeeGitApp/Extensions/ModelExtensions.cs
@@ -6,6 +6,8 @@ namespace SeeGit
{
public static class ModelExtensions
{
+ private const string GitDirectoryName = ".git";
+
public static string AtMost(this string s, int characterCount)
{
if (s == null) return null;
@@ -21,14 +23,15 @@ public static string GetGitRepositoryPath(string path)
if (path == null) throw new ArgumentNullException("path");
//If we are passed a .git directory, just return it straightaway
- if (path.EndsWith(".git", StringComparison.OrdinalIgnoreCase))
+ DirectoryInfo pathDirectoryInfo = new DirectoryInfo(path);
+ if (pathDirectoryInfo.Name == ".git")
{
return path;
}
- if (!Directory.Exists(path)) return Path.Combine(path, ".git");
+ if (!pathDirectoryInfo.Exists) return Path.Combine(path, ".git");
- DirectoryInfo checkIn = new DirectoryInfo(path);
+ DirectoryInfo checkIn = pathDirectoryInfo;
while (checkIn != null)
{

0 comments on commit f5b497a

Please sign in to comment.