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

Commit 8969d10

Browse files
GitClient should return user
1 parent 985c390 commit 8969d10

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,10 @@ private void MaybeUpdateData()
115115
{
116116
if ((cachedUser == null || String.IsNullOrEmpty(cachedUser.Name)) && GitClient != null)
117117
{
118-
GitClient.GetConfigUserAndEmail().FinallyInUI((success, ex, strings) => {
119-
var username = strings[0];
120-
var email = strings[1];
121-
122-
if (success && !String.IsNullOrEmpty(username) && !String.IsNullOrEmpty(email))
118+
GitClient.GetConfigUserAndEmail().FinallyInUI((success, ex, user) => {
119+
if (success && !String.IsNullOrEmpty(user.Name) && !String.IsNullOrEmpty(user.Email))
123120
{
124-
cachedUser = new User {
125-
Name = username,
126-
Email = email
127-
};
121+
cachedUser = user;
128122

129123
userDataHasChanged = true;
130124
Redraw();

0 commit comments

Comments
 (0)