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

Commit 0c34765

Browse files
Merge branch 'master' into branches-view
2 parents f5b4fae + ca56968 commit 0c34765

File tree

13 files changed

+276
-240
lines changed

13 files changed

+276
-240
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/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: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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;
@@ -260,23 +264,30 @@ public ITask<User> GetConfigUserAndEmail()
260264
string username = null;
261265
string email = null;
262266

263-
return GetConfig("user.name", GitConfigSource.User)
267+
return GetConfig(UserNameConfigKey, GitConfigSource.User)
264268
.Then((success, value) => {
265269
if (success)
266270
{
267271
username = value;
268272
}
269273
})
270-
.Then(GetConfig("user.email", GitConfigSource.User)
274+
.Then(GetConfig(UserEmailConfigKey, GitConfigSource.User)
271275
.Then((success, value) => {
272276
if (success)
273277
{
274278
email = value;
275279
}
276280
})).Then(success => {
277-
Logger.Trace("{0}:{1} {2}:{3}", "user.name", username, "user.email", email);
278-
return new User { Name= username, Email = email };
279-
});
281+
Logger.Trace("{0}:{1} {2}:{3}", UserNameConfigKey, username, UserEmailConfigKey, email);
282+
return new User { Name = username, Email = email };
283+
});
284+
}
285+
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 });
280291
}
281292

282293
public ITask<List<GitLock>> ListLocks(bool local, BaseOutputListProcessor<GitLock> processor = null)

src/GitHub.Api/Git/Repository.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ private void CacheContainer_OnCacheInvalidated(CacheType cacheType)
323323
case CacheType.GitUserCache:
324324
break;
325325

326+
case CacheType.RepositoryInfoCache:
327+
break;
328+
326329
default:
327330
throw new ArgumentOutOfRangeException(nameof(cacheType), cacheType, null);
328331
}
@@ -442,7 +445,7 @@ private void RepositoryManager_OnCurrentBranchAndRemoteUpdated(ConfigBranch? bra
442445
{
443446
CurrentConfigRemote = remote;
444447
CurrentRemote = GetGitRemote(remote.Value);
445-
UpdateRepositoryInfo();
448+
ClearRepositoryInfo();
446449
}
447450
}) { Affinity = TaskAffinity.UI }.Start();
448451
}
@@ -485,20 +488,10 @@ private void UpdateLocalBranches()
485488
LocalBranches = LocalConfigBranches.Values.Select(GetLocalGitBranch).ToArray();
486489
}
487490

488-
private void UpdateRepositoryInfo()
491+
private void ClearRepositoryInfo()
489492
{
490-
if (CurrentRemote.HasValue)
491-
{
492-
CloneUrl = new UriString(CurrentRemote.Value.Url);
493-
Name = CloneUrl.RepositoryName;
494-
Logger.Trace("CloneUrl: {0}", CloneUrl.ToString());
495-
}
496-
else
497-
{
498-
CloneUrl = null;
499-
Name = LocalPath.FileName;
500-
Logger.Trace("CloneUrl: [NULL]");
501-
}
493+
CloneUrl = null;
494+
Name = null;
502495
}
503496

504497
private void RepositoryManager_OnLocalBranchRemoved(string name)

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ class RepositoryManager : IRepositoryManager
9696
private readonly IGitClient gitClient;
9797
private readonly IPlatform platform;
9898
private readonly IRepositoryPathConfiguration repositoryPaths;
99-
private readonly ITaskManager taskManager;
10099
private readonly IRepositoryWatcher watcher;
101100

102101
private bool isBusy;
@@ -113,13 +112,12 @@ class RepositoryManager : IRepositoryManager
113112
public event Action<string, string> OnRemoteBranchRemoved;
114113
public event Action OnRepositoryUpdated;
115114

116-
public RepositoryManager(IPlatform platform, ITaskManager taskManager, IGitConfig gitConfig,
115+
public RepositoryManager(IPlatform platform, IGitConfig gitConfig,
117116
IRepositoryWatcher repositoryWatcher, IGitClient gitClient,
118117
IRepositoryPathConfiguration repositoryPaths)
119118
{
120119
this.repositoryPaths = repositoryPaths;
121120
this.platform = platform;
122-
this.taskManager = taskManager;
123121
this.gitClient = gitClient;
124122
this.watcher = repositoryWatcher;
125123
this.config = gitConfig;
@@ -136,7 +134,7 @@ public static RepositoryManager CreateInstance(IPlatform platform, ITaskManager
136134

137135
var repositoryWatcher = new RepositoryWatcher(platform, repositoryPathConfiguration, taskManager.Token);
138136

139-
return new RepositoryManager(platform, taskManager, gitConfig, repositoryWatcher,
137+
return new RepositoryManager(platform, gitConfig, repositoryWatcher,
140138
gitClient, repositoryPathConfiguration);
141139
}
142140

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)