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

Commit 592687c

Browse files
Merge branch 'master' into fixes/stop-watcher-for-commit
2 parents 19a9641 + 086ea4a commit 592687c

File tree

20 files changed

+187
-256
lines changed

20 files changed

+187
-256
lines changed

common/SolutionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
namespace System
3232
{
3333
internal static class AssemblyVersionInformation {
34-
internal const string Version = "0.22.0";
34+
internal const string Version = "0.23.0";
3535
}
3636
}

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/Cache/CacheInterfaces.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public interface ILocalConfigBranchDictionary : IDictionary<string, ConfigBranch
6262

6363
}
6464

65-
public interface IRemoteConfigBranchDictionary : IDictionary<string, IDictionary<string, ConfigBranch>>
65+
public interface IRemoteConfigBranchDictionary : IDictionary<string, Dictionary<string, ConfigBranch>>
6666
{
6767

6868
}

src/GitHub.Api/Git/GitClient.cs

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ITask<string> GetConfig(string key, GitConfigSource configSource,
2323
ITask<string> SetConfig(string key, string value, GitConfigSource configSource,
2424
IOutputProcessor<string> processor = null);
2525

26-
ITask<string[]> GetConfigUserAndEmail();
26+
ITask<User> GetConfigUserAndEmail();
2727

2828
ITask<List<GitLock>> ListLocks(bool local,
2929
BaseOutputListProcessor<GitLock> processor = null);
@@ -83,10 +83,14 @@ ITask<string> Unlock(string file, bool force,
8383
ITask<Version> Version(IOutputProcessor<Version> processor = null);
8484

8585
ITask<Version> LfsVersion(IOutputProcessor<Version> processor = null);
86+
87+
ITask<User> SetConfigUserAndEmail(string username, string email);
8688
}
8789

8890
class GitClient : IGitClient
8991
{
92+
private const string UserNameConfigKey = "user.name";
93+
private const string UserEmailConfigKey = "user.email";
9094
private readonly IEnvironment environment;
9195
private readonly IProcessManager processManager;
9296
private readonly ITaskManager taskManager;
@@ -255,28 +259,37 @@ public ITask<string> SetConfig(string key, string value, GitConfigSource configS
255259
.Configure(processManager);
256260
}
257261

258-
public ITask<string[]> GetConfigUserAndEmail()
262+
public ITask<User> GetConfigUserAndEmail()
259263
{
260264
string username = null;
261265
string email = null;
262266

263-
return GetConfig("user.name", GitConfigSource.User).Then((success, value) => {
264-
if (success)
265-
{
266-
username = value;
267-
}
268-
269-
}).Then(GetConfig("user.email", GitConfigSource.User).Then((success, value) => {
270-
if (success)
271-
{
272-
email = value;
273-
}
274-
})).Then(success => {
275-
Logger.Trace("user.name:{1} user.email:{2}", success, username, email);
276-
return new[] { username, email };
267+
return GetConfig(UserNameConfigKey, GitConfigSource.User)
268+
.Then((success, value) => {
269+
if (success)
270+
{
271+
username = value;
272+
}
273+
})
274+
.Then(GetConfig(UserEmailConfigKey, GitConfigSource.User)
275+
.Then((success, value) => {
276+
if (success)
277+
{
278+
email = value;
279+
}
280+
})).Then(success => {
281+
Logger.Trace("{0}:{1} {2}:{3}", UserNameConfigKey, username, UserEmailConfigKey, email);
282+
return new User { Name = username, Email = email };
277283
});
278284
}
279285

286+
public ITask<User> SetConfigUserAndEmail(string username, string email)
287+
{
288+
return SetConfig(UserNameConfigKey, username, GitConfigSource.User)
289+
.Then(SetConfig(UserEmailConfigKey, email, GitConfigSource.User))
290+
.Then(b => new User { Name = username, Email = email });
291+
}
292+
280293
public ITask<List<GitLock>> ListLocks(bool local, BaseOutputListProcessor<GitLock> processor = null)
281294
{
282295
Logger.Trace("ListLocks");

src/GitHub.Api/Git/IRepository.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public interface IRepository : IEquatable<IRepository>
1919
ITask RequestLock(string file);
2020
ITask ReleaseLock(string file, bool force);
2121

22+
void RefreshLog();
23+
void RefreshStatus();
24+
void UpdateConfigData();
2225
void CheckLogChangedEvent(CacheUpdateEvent gitLogCacheUpdateEvent);
2326
void CheckStatusChangedEvent(CacheUpdateEvent cacheUpdateEvent);
2427
void CheckCurrentBranchChangedEvent(CacheUpdateEvent cacheUpdateEvent);

src/GitHub.Api/Git/Repository.cs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,22 @@ public ITask SetupRemote(string remote, string remoteUrl)
8181

8282
public ITask CommitAllFiles(string message, string body)
8383
{
84-
return repositoryManager.CommitAllFiles(message, body);
84+
return repositoryManager
85+
.CommitAllFiles(message, body)
86+
.Then(() => {
87+
UpdateGitStatus();
88+
UpdateGitLog();
89+
});
8590
}
8691

8792
public ITask CommitFiles(List<string> files, string message, string body)
8893
{
89-
return repositoryManager.CommitFiles(files, message, body);
94+
return repositoryManager
95+
.CommitFiles(files, message, body)
96+
.Then(() => {
97+
UpdateGitStatus();
98+
UpdateGitLog();
99+
});
90100
}
91101

92102
public ITask Pull()
@@ -122,6 +132,21 @@ public ITask ReleaseLock(string file, bool force)
122132
.Then(UpdateLocks);
123133
}
124134

135+
public void RefreshLog()
136+
{
137+
UpdateGitLog();
138+
}
139+
140+
public void RefreshStatus()
141+
{
142+
UpdateGitStatus();
143+
}
144+
145+
public void UpdateConfigData()
146+
{
147+
repositoryManager?.UpdateConfigData();
148+
}
149+
125150
public void CheckLogChangedEvent(CacheUpdateEvent cacheUpdateEvent)
126151
{
127152
var managedCache = cacheContainer.GitLogCache;

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 9 additions & 14 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

@@ -296,21 +295,17 @@ public ITask UnlockFile(string file, bool force)
296295
return HookupHandlers(task);
297296
}
298297

298+
public void UpdateConfigData()
299+
{
300+
UpdateConfigData(false);
301+
}
302+
299303
private void LoadGitUser()
300304
{
301305
GitClient.GetConfigUserAndEmail()
302-
.Then((success, strings) => {
303-
var username = strings[0];
304-
var email = strings[1];
305-
306-
var user = new User {
307-
Name = username,
308-
Email = email
309-
};
310-
306+
.Then((success, user) => {
311307
Logger.Trace("OnGitUserLoaded: {0}", user);
312308
OnGitUserLoaded?.Invoke(user);
313-
314309
}).Start();
315310
}
316311

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

0 commit comments

Comments
 (0)