Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 157f11f

Browse files
Merge branch 'master' into fixes/git-client-set-user
2 parents f47d76f + 63ff89b commit 157f11f

File tree

10 files changed

+49
-25
lines changed

10 files changed

+49
-25
lines changed

docs/contributing/how-to-build.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This repository is LFS-enabled. To clone it, you should use a git client that su
66

77
### Windows
88

9-
- Visual Studio 2015+ or Mono 4.x + bash shell (git bash).
9+
- Visual Studio 2015+ or [Mono 4.x](https://download.mono-project.com/archive/4.8.1/windows-installer/) + bash shell (git bash).
1010
- Mono 5.x will not work
1111
- `UnityEngine.dll` and `UnityEditor.dll`.
1212
- If you've installed Unity in the default location of `C:\Program Files\Unity` or `C:\Program Files (x86)\Unity`, the build will be able to reference these DLLs automatically. Otherwise, you'll need to copy these DLLs from `[Unity installation path]\Unity\Editor\Data\Managed` into the `lib` directory in order for the build to work
@@ -48,7 +48,7 @@ To build with Visual Studio 2015+, open the solution file `GitHub.Unity.sln`. Se
4848

4949
### Mono and Bash (windows and mac)
5050

51-
To build with Mono 4.x and Bash execute `build.sh` in a bash shell.
51+
To build with Mono 4.x and Bash, first ensure Mono is added to PATH. Mono installs to `C:\Program Files\Mono\bin\` by default. Then execute `build.sh` in a bash shell.
5252

5353
## Build Output
5454

src/GitHub.Api/Git/IRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public interface IRepository : IEquatable<IRepository>
2121

2222
void RefreshLog();
2323
void RefreshStatus();
24-
24+
void UpdateConfigData();
2525
void CheckLogChangedEvent(CacheUpdateEvent gitLogCacheUpdateEvent);
2626
void CheckStatusChangedEvent(CacheUpdateEvent cacheUpdateEvent);
2727
void CheckCurrentBranchChangedEvent(CacheUpdateEvent cacheUpdateEvent);

src/GitHub.Api/Git/Repository.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public void RefreshStatus()
142142
UpdateGitStatus();
143143
}
144144

145+
public void UpdateConfigData()
146+
{
147+
repositoryManager?.UpdateConfigData();
148+
}
149+
145150
public void CheckLogChangedEvent(CacheUpdateEvent cacheUpdateEvent)
146151
{
147152
var managedCache = cacheContainer.GitLogCache;

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public interface IRepositoryManager : IDisposable
4040
ITask LockFile(string file);
4141
ITask UnlockFile(string file, bool force);
4242
int WaitForEvents();
43+
void UpdateConfigData();
4344

4445
IGitConfig Config { get; }
4546
IGitClient GitClient { get; }
@@ -95,7 +96,6 @@ class RepositoryManager : IRepositoryManager
9596
private readonly IGitClient gitClient;
9697
private readonly IPlatform platform;
9798
private readonly IRepositoryPathConfiguration repositoryPaths;
98-
private readonly ITaskManager taskManager;
9999
private readonly IRepositoryWatcher watcher;
100100

101101
private bool isBusy;
@@ -112,13 +112,12 @@ class RepositoryManager : IRepositoryManager
112112
public event Action<string, string> OnRemoteBranchRemoved;
113113
public event Action OnRepositoryUpdated;
114114

115-
public RepositoryManager(IPlatform platform, ITaskManager taskManager, IGitConfig gitConfig,
115+
public RepositoryManager(IPlatform platform, IGitConfig gitConfig,
116116
IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
117117
IRepositoryPathConfiguration repositoryPaths)
118118
{
119119
this.repositoryPaths = repositoryPaths;
120120
this.platform = platform;
121-
this.taskManager = taskManager;
122121
this.gitClient = gitClient;
123122
this.watcher = repositoryWatcher;
124123
this.config = gitConfig;
@@ -135,7 +134,7 @@ public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager
135134

136135
var repositoryWatcher = new RepositoryWatcher(platform, repositoryPathConfiguration, taskManager.Token);
137136

138-
return new RepositoryManager(platform, taskManager, gitConfig, repositoryWatcher,
137+
return new RepositoryManager(platform, gitConfig, repositoryWatcher,
139138
gitClient, repositoryPathConfiguration);
140139
}
141140

@@ -177,7 +176,6 @@ public ITask CommitAllFiles(string message, string body)
177176
add.OnStart += t => IsBusy = true;
178177
return add
179178
.Then(GitClient.Commit(message, body))
180-
.Then(UpdateConfigData)
181179
.Finally(() => IsBusy = false);
182180
}
183181

@@ -187,7 +185,6 @@ public ITask CommitFiles(List<string> files, string message, string body)
187185
add.OnStart += t => IsBusy = true;
188186
return add
189187
.Then(GitClient.Commit(message, body))
190-
.Then(UpdateConfigData)
191188
.Finally(() => IsBusy = false);
192189
}
193190

@@ -298,6 +295,11 @@ public ITask UnlockFile(string file, bool force)
298295
return HookupHandlers(task);
299296
}
300297

298+
public void UpdateConfigData()
299+
{
300+
UpdateConfigData(false);
301+
}
302+
301303
private void LoadGitUser()
302304
{
303305
GitClient.GetConfigUserAndEmail()

src/GitHub.Api/Helpers/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ static class Constants
99
public const string UsageFile = "usage.json";
1010
public const string GitInstallPathKey = "GitInstallPath";
1111
public const string TraceLoggingKey = "EnableTraceLogging";
12+
public const string Iso8601Format = "o";
1213

1314
public static readonly Version MinimumGitVersion = new Version(2, 11, 0);
1415
public static readonly Version MinimumGitLfsVersion = new Version(2, 3, 4);

src/GitHub.Api/OutputProcessors/LogEntryOutputProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ private void ReturnGitLogEntry()
329329
Summary = summary,
330330
Description = description,
331331
CommitID = commitId,
332-
TimeString = time.Value.ToString(DateTimeFormatInfo.CurrentInfo),
333-
CommitTimeString = committerTime.Value.ToString(DateTimeFormatInfo.CurrentInfo)
332+
TimeString = time.Value.ToString(Constants.Iso8601Format),
333+
CommitTimeString = committerTime.Value.ToString(Constants.Iso8601Format)
334334
});
335335
}
336336

src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using System.Linq;
4-
using Octokit;
55
using UnityEditor;
66
using UnityEngine;
77
using Application = UnityEngine.Application;
@@ -92,7 +92,6 @@ abstract class ManagedCacheBase<T> : ScriptObjectSingleton<T> where T : Scriptab
9292
private static readonly TimeSpan DataTimeout = TimeSpan.MaxValue;
9393

9494
[NonSerialized] private DateTimeOffset? lastUpdatedAtValue;
95-
9695
[NonSerialized] private DateTimeOffset? lastVerifiedAtValue;
9796

9897
public event Action CacheInvalidated;
@@ -148,14 +147,22 @@ public DateTimeOffset LastUpdatedAt
148147
{
149148
if (!lastUpdatedAtValue.HasValue)
150149
{
151-
lastUpdatedAtValue = DateTimeOffset.Parse(LastUpdatedAtString);
150+
DateTimeOffset result;
151+
if (DateTimeOffset.TryParseExact(LastUpdatedAtString, Constants.Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.None, out result))
152+
{
153+
lastUpdatedAtValue = result;
154+
}
155+
else
156+
{
157+
lastUpdatedAtValue = DateTimeOffset.MinValue;
158+
}
152159
}
153160

154161
return lastUpdatedAtValue.Value;
155162
}
156163
set
157164
{
158-
LastUpdatedAtString = value.ToString();
165+
LastUpdatedAtString = value.ToString(Constants.Iso8601Format);
159166
lastUpdatedAtValue = null;
160167
}
161168
}
@@ -166,14 +173,22 @@ public DateTimeOffset LastVerifiedAt
166173
{
167174
if (!lastVerifiedAtValue.HasValue)
168175
{
169-
lastVerifiedAtValue = DateTimeOffset.Parse(LastVerifiedAtString);
176+
DateTimeOffset result;
177+
if (DateTimeOffset.TryParseExact(LastVerifiedAtString, Constants.Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.None, out result))
178+
{
179+
lastVerifiedAtValue = result;
180+
}
181+
else
182+
{
183+
lastVerifiedAtValue = DateTimeOffset.MinValue;
184+
}
170185
}
171186

172187
return lastVerifiedAtValue.Value;
173188
}
174189
set
175190
{
176-
LastVerifiedAtString = value.ToString();
191+
LastVerifiedAtString = value.ToString(Constants.Iso8601Format);
177192
lastVerifiedAtValue = null;
178193
}
179194
}

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public override void OnEnable()
6868
if (Repository != null)
6969
{
7070
Repository.CheckLocalAndRemoteBranchListChangedEvent(lastLocalAndRemoteBranchListChangedEvent);
71+
Repository.UpdateConfigData();
7172
}
7273
}
7374

src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public async Task LogEntriesTest()
5757
CommitID = "018997938335742f8be694240a7c2b352ec0835f",
5858
Description = "Moving project files where they should be kept",
5959
Summary = "Moving project files where they should be kept",
60-
TimeString = firstCommitTime.ToString(DateTimeFormatInfo.CurrentInfo),
61-
CommitTimeString = firstCommitTime.ToString(DateTimeFormatInfo.CurrentInfo),
60+
TimeString = firstCommitTime.ToString(Constants.Iso8601Format),
61+
CommitTimeString = firstCommitTime.ToString(Constants.Iso8601Format),
6262
},
6363
new GitLogEntry
6464
{
@@ -75,8 +75,8 @@ public async Task LogEntriesTest()
7575
CommitID = "03939ffb3eb8486dba0259b43db00842bbe6eca1",
7676
Description = "Initial Commit",
7777
Summary = "Initial Commit",
78-
TimeString = secondCommitTime.ToString(DateTimeFormatInfo.CurrentInfo),
79-
CommitTimeString = secondCommitTime.ToString(DateTimeFormatInfo.CurrentInfo),
78+
TimeString = secondCommitTime.ToString(Constants.Iso8601Format),
79+
CommitTimeString = secondCommitTime.ToString(Constants.Iso8601Format),
8080
},
8181
});
8282
}
@@ -110,8 +110,8 @@ public async Task RussianLogEntriesTest()
110110
CommitID = "06d6451d351626894a30e9134f551db12c74254b",
111111
Description = "Я люблю github",
112112
Summary = "Я люблю github",
113-
TimeString = commitTime.ToString(DateTimeFormatInfo.CurrentInfo),
114-
CommitTimeString = commitTime.ToString(DateTimeFormatInfo.CurrentInfo),
113+
TimeString = commitTime.ToString(Constants.Iso8601Format),
114+
CommitTimeString = commitTime.ToString(Constants.Iso8601Format),
115115
}
116116
});
117117
}

src/tests/UnitTests/IO/LogEntryOutputProcessorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public void ShouldParseSingleCommit()
5858
},
5959
Summary = "Rename RepositoryModelBase to RepositoryModel",
6060
Description = "Rename RepositoryModelBase to RepositoryModel",
61-
TimeString = commitTime.ToString(DateTimeFormatInfo.CurrentInfo),
62-
CommitTimeString = commitTime.ToString(DateTimeFormatInfo.CurrentInfo),
61+
TimeString = commitTime.ToString(Constants.Iso8601Format),
62+
CommitTimeString = commitTime.ToString(Constants.Iso8601Format),
6363
},
6464
};
6565

0 commit comments

Comments
 (0)