public static bool ValidWorkingDir(string dir)
{
if (string.IsNullOrEmpty(dir))
return false;
if (Directory.Exists(dir + PathSeperator + ".git"))
return true;
return !dir.Contains(".git") &&
Directory.Exists(dir + PathSeperator + "info") &&
Directory.Exists(dir + PathSeperator + "objects") &&
Directory.Exists(dir + PathSeperator + "refs");
}