Skip to content

Commit 6f4c245

Browse files
author
Simon Ejsing
committed
Isolate write operation
1 parent e19687d commit 6f4c245

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/GitVersionCore/ExecuteCore.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ public VersionVariables ExecuteGitVersion(string targetUrl, string dynamicReposi
6262
{
6363
gitVersionCache.WriteVariablesToDiskCache(repo, dotGitDirectory, versionVariables);
6464
}
65-
catch (IOException)
65+
catch (IOException e)
6666
{
67-
Logger.WriteInfo("I/O exception during cache write");
67+
Logger.WriteWarning(string.Format("I/O exception during cache write:{0}{1}", Environment.NewLine, e));
6868
}
6969
}
7070

src/GitVersionCore/GitVersionCache.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ public void WriteVariablesToDiskCache(IRepository repo, string gitDir, VersionVa
2424
var cacheFileName = GetCacheFileName(GetKey(repo, gitDir), GetCacheDir(gitDir));
2525
variablesFromCache.FileName = cacheFileName;
2626

27+
Dictionary<string, string> dictionary;
28+
using (Logger.IndentLog("Creating dictionary"))
29+
{
30+
dictionary = variablesFromCache.ToDictionary(x => x.Key, x => x.Value);
31+
}
32+
2733
using (var stream = fileSystem.OpenWrite(cacheFileName))
2834
{
2935
using (var sw = new StreamWriter(stream))
3036
{
31-
Dictionary<string, string> dictionary;
32-
using (Logger.IndentLog("Creating dictionary"))
33-
{
34-
dictionary = variablesFromCache.ToDictionary(x => x.Key, x => x.Value);
35-
}
36-
3737
using (Logger.IndentLog("Storing version variables to cache file " + cacheFileName))
3838
{
3939
var serializer = new Serializer();

0 commit comments

Comments
 (0)