Skip to content

Commit d7a6402

Browse files
committed
Removing some formatting changes
1 parent a0af556 commit d7a6402

15 files changed

+44
-199
lines changed

src/GitVersionCore.Tests/FileSystemTests.cs

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/GitVersionCore.Tests/GitVersionCore.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@
129129
<Compile Include="ConfigProviderTests.cs" />
130130
<Compile Include="Fixtures\LocalRepositoryFixture.cs" />
131131
<Compile Include="Fixtures\RemoteRepositoryFixture.cs" />
132-
<Compile Include="FileSystemTests.cs" />
133132
<Compile Include="Fixtures\BaseGitFlowRepositoryFixture.cs" />
134133
<Compile Include="GitHelperTests.cs" />
135134
<Compile Include="GitPreparerTests.cs" />

src/GitVersionCore.Tests/TestFileSystem.cs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,85 +11,73 @@ public class TestFileSystem : IFileSystem
1111
{
1212
Dictionary<string, string> fileSystem = new Dictionary<string, string>();
1313

14-
1514
public void Copy(string @from, string to, bool overwrite)
1615
{
1716
throw new NotImplementedException();
1817
}
1918

20-
2119
public void Move(string @from, string to)
2220
{
2321
throw new NotImplementedException();
2422
}
2523

26-
2724
public bool Exists(string file)
2825
{
29-
return this.fileSystem.ContainsKey(file);
26+
return fileSystem.ContainsKey(file);
3027
}
3128

32-
3329
public void Delete(string path)
3430
{
3531
throw new NotImplementedException();
3632
}
3733

38-
3934
public string ReadAllText(string path)
4035
{
41-
return this.fileSystem[path];
36+
return fileSystem[path];
4237
}
4338

44-
4539
public void WriteAllText(string file, string fileContents)
4640
{
47-
if (this.fileSystem.ContainsKey(file))
41+
if (fileSystem.ContainsKey(file))
4842
{
49-
this.fileSystem[file] = fileContents;
43+
fileSystem[file] = fileContents;
5044
}
5145
else
5246
{
53-
this.fileSystem.Add(file, fileContents);
47+
fileSystem.Add(file, fileContents);
5448
}
5549
}
5650

57-
5851
public IEnumerable<string> DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption)
5952
{
6053
throw new NotImplementedException();
6154
}
6255

63-
6456
public Stream OpenWrite(string path)
6557
{
6658
return new TestStream(path, this);
6759
}
6860

69-
7061
public Stream OpenRead(string path)
7162
{
72-
if (this.fileSystem.ContainsKey(path))
63+
if (fileSystem.ContainsKey(path))
7364
{
74-
var content = this.fileSystem[path];
65+
var content = fileSystem[path];
7566
return new MemoryStream(Encoding.UTF8.GetBytes(content));
7667
}
7768

7869
throw new FileNotFoundException("File not found.", path);
7970
}
8071

81-
8272
public void CreateDirectory(string path)
8373
{
8474
}
8575

86-
8776
public long GetLastDirectoryWrite(string path)
8877
{
8978
return 1;
9079
}
9180

92-
9381
public IRepository GetRepository(string gitDirectory)
9482
{
9583
throw new NotImplementedException();

src/GitVersionCore/ExecuteCore.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class ExecuteCore
1818
readonly IFileSystem fileSystem;
1919
readonly Func<string, Func<string, VersionVariables>, VersionVariables> getOrAddFromCache;
2020

21-
2221
public ExecuteCore(IFileSystem fileSystem, Func<string, Func<string, VersionVariables>, VersionVariables> getOrAddFromCache = null)
2322
{
2423
if (fileSystem == null)
@@ -30,7 +29,6 @@ public ExecuteCore(IFileSystem fileSystem, Func<string, Func<string, VersionVari
3029
this.fileSystem = fileSystem;
3130
}
3231

33-
3432
public VersionVariables ExecuteGitVersion(string targetUrl, string dynamicRepositoryLocation, Authentication authentication, string targetBranch, bool noFetch, string workingDirectory, string commitId)
3533
{
3634
var gitDir = Repository.Discover(workingDirectory);
@@ -53,7 +51,6 @@ public VersionVariables ExecuteGitVersion(string targetUrl, string dynamicReposi
5351
}
5452
}
5553

56-
5754
public bool TryGetVersion(string directory, out VersionVariables versionVariables, bool noFetch, Authentication authentication)
5855
{
5956
try
@@ -69,7 +66,6 @@ public bool TryGetVersion(string directory, out VersionVariables versionVariable
6966
}
7067
}
7168

72-
7369
static string ResolveCurrentBranch(IBuildServer buildServer, string targetBranch)
7470
{
7571
if (buildServer == null)
@@ -83,7 +79,6 @@ static string ResolveCurrentBranch(IBuildServer buildServer, string targetBranch
8379
return currentBranch;
8480
}
8581

86-
8782
VersionVariables LoadVersionVariablesFromDiskCache(string key, string gitDir, string targetUrl, string dynamicRepositoryLocation, Authentication authentication, string targetBranch, bool noFetch, string workingDirectory, string commitId)
8883
{
8984
using (Logger.IndentLog("Loading version variables from disk cache"))
@@ -157,7 +152,6 @@ VersionVariables LoadVersionVariablesFromDiskCache(string key, string gitDir, st
157152
}
158153
}
159154

160-
161155
VersionVariables ExecuteInternal(string targetUrl, string dynamicRepositoryLocation, Authentication authentication, string targetBranch, bool noFetch, string workingDirectory, string commitId)
162156
{
163157
// Normalise if we are running on build server

src/GitVersionCore/GitPreparer.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ namespace GitVersion
88

99
public class GitPreparer
1010
{
11-
Authentication authentication;
11+
string targetUrl;
1212
string dynamicRepositoryLocation;
13+
Authentication authentication;
1314
bool noFetch;
1415
string targetPath;
15-
string targetUrl;
16-
1716

1817
public GitPreparer(string targetUrl, string dynamicRepositoryLocation, Authentication authentication, bool noFetch, string targetPath)
1918
{
@@ -24,15 +23,13 @@ public GitPreparer(string targetUrl, string dynamicRepositoryLocation, Authentic
2423
this.targetPath = targetPath;
2524
}
2625

27-
2826
public bool IsDynamicGitRepository
2927
{
3028
get { return !string.IsNullOrWhiteSpace(DynamicGitRepositoryPath); }
3129
}
3230

3331
public string DynamicGitRepositoryPath { get; private set; }
3432

35-
3633
public void Initialise(bool normaliseGitDirectory, string currentBranch)
3734
{
3835
if (string.IsNullOrWhiteSpace(targetUrl))
@@ -49,7 +46,6 @@ public void Initialise(bool normaliseGitDirectory, string currentBranch)
4946
DynamicGitRepositoryPath = CreateDynamicRepository(tempRepositoryPath, authentication, targetUrl, currentBranch, noFetch);
5047
}
5148

52-
5349
static string CalculateTemporaryRepositoryPath(string targetUrl, string dynamicRepositoryLocation)
5450
{
5551
var userTemp = dynamicRepositoryLocation ?? Path.GetTempPath();
@@ -75,7 +71,6 @@ static string CalculateTemporaryRepositoryPath(string targetUrl, string dynamicR
7571
return possiblePath;
7672
}
7773

78-
7974
static bool GitRepoHasMatchingRemote(string possiblePath, string targetUrl)
8075
{
8176
try
@@ -91,7 +86,6 @@ static bool GitRepoHasMatchingRemote(string possiblePath, string targetUrl)
9186
}
9287
}
9388

94-
9589
public string GetDotGitDirectory()
9690
{
9791
if (IsDynamicGitRepository)
@@ -102,7 +96,6 @@ public string GetDotGitDirectory()
10296
return Repository.Discover(this.targetPath);
10397
}
10498

105-
10699
public string GetProjectRootDirectory()
107100
{
108101
if (IsDynamicGitRepository)
@@ -116,7 +109,6 @@ public string GetProjectRootDirectory()
116109
return Directory.GetParent(gitDir).FullName;
117110
}
118111

119-
120112
static string CreateDynamicRepository(string targetPath, Authentication authentication, string repositoryUrl, string targetBranch, bool noFetch)
121113
{
122114
if (string.IsNullOrWhiteSpace(targetBranch))
@@ -142,7 +134,6 @@ static string CreateDynamicRepository(string targetPath, Authentication authenti
142134
return gitDirectory;
143135
}
144136

145-
146137
static void CloneRepository(string repositoryUrl, string gitDirectory, Authentication authentication)
147138
{
148139
Credentials credentials = null;
@@ -161,12 +152,12 @@ static void CloneRepository(string repositoryUrl, string gitDirectory, Authentic
161152

162153
try
163154
{
164-
Repository.Clone(repositoryUrl, gitDirectory,
165-
new CloneOptions
166-
{
167-
Checkout = false,
168-
CredentialsProvider = (url, usernameFromUrl, types) => credentials
169-
});
155+
var cloneOptions = new CloneOptions
156+
{
157+
Checkout = false,
158+
CredentialsProvider = (url, usernameFromUrl, types) => credentials
159+
};
160+
Repository.Clone(repositoryUrl, gitDirectory, cloneOptions);
170161
}
171162
catch (LibGit2SharpException ex)
172163
{

src/GitVersionCore/Helpers/FileSystem.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,61 +14,51 @@ public void Copy(string @from, string to, bool overwrite)
1414
File.Copy(from, to, overwrite);
1515
}
1616

17-
1817
public void Move(string @from, string to)
1918
{
2019
File.Move(from, to);
2120
}
2221

23-
2422
public bool Exists(string file)
2523
{
2624
return File.Exists(file);
2725
}
2826

29-
3027
public void Delete(string path)
3128
{
3229
File.Delete(path);
3330
}
3431

35-
3632
public string ReadAllText(string path)
3733
{
3834
return File.ReadAllText(path);
3935
}
4036

41-
4237
public void WriteAllText(string file, string fileContents)
4338
{
4439
File.WriteAllText(file, fileContents);
4540
}
4641

47-
4842
public IEnumerable<string> DirectoryGetFiles(string directory, string searchPattern, SearchOption searchOption)
4943
{
5044
return Directory.GetFiles(directory, searchPattern, searchOption);
5145
}
5246

53-
5447
public Stream OpenWrite(string path)
5548
{
5649
return File.OpenWrite(path);
5750
}
5851

59-
6052
public Stream OpenRead(string path)
6153
{
6254
return File.OpenRead(path);
6355
}
6456

65-
6657
public void CreateDirectory(string path)
6758
{
6859
Directory.CreateDirectory(path);
6960
}
7061

71-
7262
public long GetLastDirectoryWrite(string path)
7363
{
7464
return new DirectoryInfo(path)
@@ -79,7 +69,6 @@ public long GetLastDirectoryWrite(string path)
7969
.Ticks;
8070
}
8171

82-
8372
public IRepository GetRepository(string gitDirectory)
8473
{
8574
try

0 commit comments

Comments
 (0)