Skip to content

Commit a2e3ddf

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

File tree

11 files changed

+24
-99
lines changed

11 files changed

+24
-99
lines changed

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

src/GitVersionCore/Logger.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ static Logger()
1515
Reset();
1616
}
1717

18-
1918
public static Action<string> WriteInfo { get; private set; }
2019
public static Action<string> WriteWarning { get; private set; }
2120
public static Action<string> WriteError { get; private set; }
2221

23-
2422
public static IDisposable IndentLog(string operationDescription)
2523
{
2624
var start = DateTime.Now;
@@ -33,7 +31,6 @@ public static IDisposable IndentLog(string operationDescription)
3331
});
3432
}
3533

36-
3734
static Action<string> ObscurePassword(Action<string> info)
3835
{
3936
Action<string> logAction = s =>
@@ -44,7 +41,6 @@ static Action<string> ObscurePassword(Action<string> info)
4441
return logAction;
4542
}
4643

47-
4844
public static void SetLoggers(Action<string> info, Action<string> warn, Action<string> error)
4945
{
5046
if (info == null)
@@ -67,32 +63,27 @@ public static void SetLoggers(Action<string> info, Action<string> warn, Action<s
6763
WriteError = LogMessage(ObscurePassword(error), "ERROR");
6864
}
6965

70-
7166
static Action<string> LogMessage(Action<string> logAction, string level)
7267
{
7368
return s => logAction(string.Format(CultureInfo.InvariantCulture, "{0}{1} [{2:MM/dd/yy H:mm:ss:ff}] {3}", indent, level, DateTime.Now, s));
7469
}
7570

76-
7771
public static void Reset()
7872
{
7973
WriteInfo = s => { throw new Exception("Logger not defined."); };
8074
WriteWarning = s => { throw new Exception("Logger not defined."); };
8175
WriteError = s => { throw new Exception("Logger not defined."); };
8276
}
8377

84-
8578
class ActionDisposable : IDisposable
8679
{
8780
readonly Action action;
8881

89-
9082
public ActionDisposable(Action action)
9183
{
9284
this.action = action;
9385
}
9486

95-
9687
public void Dispose()
9788
{
9889
action();

src/GitVersionCore/OutputVariables/VersionVariables.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public VersionVariables(string major,
5858
CommitsSinceVersionSourcePadded = commitsSinceVersionSourcePadded;
5959
}
6060

61-
6261
public string Major { get; private set; }
6362
public string Minor { get; private set; }
6463
public string Patch { get; private set; }
@@ -105,7 +104,6 @@ public string this[string variable]
105104
get { return (string)typeof(VersionVariables).GetProperty(variable).GetValue(this, null); }
106105
}
107106

108-
109107
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
110108
{
111109
var type = typeof(string);
@@ -116,7 +114,6 @@ public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
116114
.GetEnumerator();
117115
}
118116

119-
120117
IEnumerator IEnumerable.GetEnumerator()
121118
{
122119
return GetEnumerator();
@@ -133,7 +130,6 @@ public static VersionVariables FromDictionary(IEnumerable<KeyValuePair<string, s
133130
return (VersionVariables)Activator.CreateInstance(type, ctorArgs);
134131
}
135132

136-
137133
public static VersionVariables FromFile(string filePath, IFileSystem fileSystem)
138134
{
139135
using (var stream = fileSystem.OpenRead(filePath))
@@ -148,7 +144,6 @@ public static VersionVariables FromFile(string filePath, IFileSystem fileSystem)
148144
}
149145
}
150146

151-
152147
public bool TryGetValue(string variable, out string variableValue)
153148
{
154149
if (ContainsKey(variable))
@@ -161,13 +156,11 @@ public bool TryGetValue(string variable, out string variableValue)
161156
return false;
162157
}
163158

164-
165159
public bool ContainsKey(string variable)
166160
{
167161
return typeof(VersionVariables).GetProperty(variable) != null;
168162
}
169163

170-
171164
sealed class ReflectionIgnoreAttribute : Attribute
172165
{
173166
}

src/GitVersionExe/SpecifiedArgumentRunner.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ class SpecifiedArgumentRunner
1212
const string MsBuild = @"c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe";
1313
static readonly ConcurrentDictionary<string, VersionVariables> versionCache;
1414

15-
1615
static SpecifiedArgumentRunner()
1716
{
1817
versionCache = new ConcurrentDictionary<string, VersionVariables>();
1918
}
2019

21-
2220
public static void Run(Arguments arguments, IFileSystem fileSystem)
2321
{
2422
var noFetch = arguments.NoFetch;
@@ -77,13 +75,10 @@ public static void Run(Arguments arguments, IFileSystem fileSystem)
7775
}
7876
}
7977

80-
8178
static bool RunMsBuildIfNeeded(Arguments args, string workingDirectory, VersionVariables variables)
8279
{
8380
if (string.IsNullOrEmpty(args.Proj))
84-
{
8581
return false;
86-
}
8782

8883
Logger.WriteInfo(string.Format("Launching {0} \"{1}\" {2}", MsBuild, args.Proj, args.ProjArgs));
8984
var results = ProcessHelper.Run(
@@ -92,35 +87,28 @@ static bool RunMsBuildIfNeeded(Arguments args, string workingDirectory, VersionV
9287
GetEnvironmentalVariables(variables));
9388

9489
if (results != 0)
95-
{
9690
throw new WarningException("MsBuild execution failed, non-zero return code");
97-
}
9891

9992
return true;
10093
}
10194

102-
10395
static bool RunExecCommandIfNeeded(Arguments args, string workingDirectory, VersionVariables variables)
10496
{
10597
if (string.IsNullOrEmpty(args.Exec))
106-
{
10798
return false;
108-
}
10999

110100
Logger.WriteInfo(string.Format("Launching {0} {1}", args.Exec, args.ExecArgs));
111101
var results = ProcessHelper.Run(
112102
Logger.WriteInfo, Logger.WriteError,
113103
null, args.Exec, args.ExecArgs, workingDirectory,
114104
GetEnvironmentalVariables(variables));
105+
115106
if (results != 0)
116-
{
117107
throw new WarningException(string.Format("Execution of {0} failed, non-zero return code", args.Exec));
118-
}
119108

120109
return true;
121110
}
122111

123-
124112
static KeyValuePair<string, string>[] GetEnvironmentalVariables(VersionVariables variables)
125113
{
126114
return variables

0 commit comments

Comments
 (0)