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

Commit 223e0bb

Browse files
Merge branch 'fixes/git-client-should-return-user' into fixes/init-proj-view-spam
# Conflicts: # src/UnityExtension/Assets/Editor/GitHub.Unity/UI/UserSettingsView.cs
2 parents 35dcc1a + 8969d10 commit 223e0bb

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

src/GitHub.Api/Git/GitClient.cs

Lines changed: 3 additions & 3 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);
@@ -255,7 +255,7 @@ public ITask<string> SetConfig(string key, string value, GitConfigSource configS
255255
.Configure(processManager);
256256
}
257257

258-
public ITask<string[]> GetConfigUserAndEmail()
258+
public ITask<User> GetConfigUserAndEmail()
259259
{
260260
string username = null;
261261
string email = null;
@@ -273,7 +273,7 @@ public ITask<string[]> GetConfigUserAndEmail()
273273
}
274274
})).Then(success => {
275275
Logger.Trace("user.name:{1} user.email:{2}", success, username, email);
276-
return new[] { username, email };
276+
return new User { Name= username, Email = email };
277277
});
278278
}
279279

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -299,18 +299,9 @@ public ITask UnlockFile(string file, bool force)
299299
private void LoadGitUser()
300300
{
301301
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-
302+
.Then((success, user) => {
311303
Logger.Trace("OnGitUserLoaded: {0}", user);
312304
OnGitUserLoaded?.Invoke(user);
313-
314305
}).Start();
315306
}
316307

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,9 @@ private void CheckForUser()
9696
Logger.Trace("Checking for user");
9797
isBusy = true;
9898

99-
GitClient.GetConfigUserAndEmail().FinallyInUI((success, ex, strings) => {
100-
var username = strings[0];
101-
var email = strings[1];
102-
99+
GitClient.GetConfigUserAndEmail().FinallyInUI((success, ex, user) => {
103100
isBusy = false;
104-
isUserDataPresent = success && !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(email);
101+
isUserDataPresent = success && !String.IsNullOrEmpty(user.Name) && !String.IsNullOrEmpty(user.Email);
105102
hasCompletedInitialCheck = true;
106103

107104
Logger.Trace("User Present: {0}", isUserDataPresent);

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,10 @@ private void UpdateUserDataFromClient()
146146
Logger.Trace("Update user data from GitClient");
147147

148148
GitClient.GetConfigUserAndEmail()
149-
.ThenInUI((success, strings) => {
150-
var username = strings[0];
151-
var email = strings[1];
152-
153-
if (success && !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(email))
149+
.ThenInUI((success, user) => {
150+
if (success && !String.IsNullOrEmpty(user.Name) && !String.IsNullOrEmpty(user.Email))
154151
{
155-
cachedUser = new User { Name = username, Email = email };
152+
cachedUser = user;
156153
newGitName = gitName = cachedUser.Name;
157154
newGitEmail = gitEmail = cachedUser.Email;
158155
Redraw();

0 commit comments

Comments
 (0)