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

Commit 6357771

Browse files
Using Repository to RemoteAdd and expecting file changes
1 parent 977b32e commit 6357771

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

src/GitHub.Api/Git/IRepository.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,8 @@ public interface IRepository : IEquatable<IRepository>, IDisposable
7272
event Action<CacheUpdateEvent> LocksChanged;
7373
event Action<CacheUpdateEvent> RemoteBranchListChanged;
7474
event Action<CacheUpdateEvent> LocalAndRemoteBranchListChanged;
75+
ITask RemoteAdd(string remote, string url);
76+
ITask RemoteRemove(string remote);
77+
ITask Push(string remote);
7578
}
7679
}

src/GitHub.Api/Git/Repository.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,15 @@ public ITask SetupRemote(string remote, string remoteUrl)
113113
public ITask CommitAllFiles(string message, string body) => repositoryManager.CommitAllFiles(message, body);
114114
public ITask CommitFiles(List<string> files, string message, string body) => repositoryManager.CommitFiles(files, message, body);
115115
public ITask Pull() => repositoryManager.Pull(CurrentRemote.Value.Name, CurrentBranch?.Name);
116+
public ITask Push(string remote) => repositoryManager.Push(remote, CurrentBranch?.Name);
116117
public ITask Push() => repositoryManager.Push(CurrentRemote.Value.Name, CurrentBranch?.Name);
117118
public ITask Fetch() => repositoryManager.Fetch(CurrentRemote.Value.Name);
118119
public ITask Revert(string changeset) => repositoryManager.Revert(changeset);
119120
public ITask RequestLock(string file) => repositoryManager.LockFile(file);
120121
public ITask ReleaseLock(string file, bool force) => repositoryManager.UnlockFile(file, force);
121122
public ITask DiscardChanges(GitStatusEntry[] gitStatusEntry) => repositoryManager.DiscardChanges(gitStatusEntry);
123+
public ITask RemoteAdd(string remote, string url) => repositoryManager.RemoteAdd(remote, url);
124+
public ITask RemoteRemove(string remote) => repositoryManager.RemoteRemove(remote);
122125

123126
public void CheckAndRaiseEventsIfCacheNewer(CacheType cacheType, CacheUpdateEvent cacheUpdateEvent) => cacheContainer.CheckAndRaiseEventsIfCacheNewer(cacheType, cacheUpdateEvent);
124127

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,19 +225,19 @@ public ITask Revert(string changeset)
225225
public ITask RemoteAdd(string remote, string url)
226226
{
227227
var task = GitClient.RemoteAdd(remote, url);
228-
return HookupHandlers(task, false);
228+
return HookupHandlers(task, true);
229229
}
230230

231231
public ITask RemoteRemove(string remote)
232232
{
233233
var task = GitClient.RemoteRemove(remote);
234-
return HookupHandlers(task, false);
234+
return HookupHandlers(task, true);
235235
}
236236

237237
public ITask RemoteChange(string remote, string url)
238238
{
239239
var task = GitClient.RemoteChange(remote, url);
240-
return HookupHandlers(task, false);
240+
return HookupHandlers(task, true);
241241
}
242242

243243
public ITask SwitchBranch(string branch)

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,11 @@ public override void OnGUI()
182182

183183
Logger.Trace("Repository Created");
184184

185-
GitClient.RemoteAdd("origin", repository.CloneUrl)
186-
.Then(GitClient.Push("origin", Repository.CurrentBranch.Value.Name))
187-
.ThenInUI(Finish)
188-
.Start();
185+
Repository.RemoteAdd("origin", repository.CloneUrl)
186+
.Then(Repository.Push("origin"))
187+
.ThenInUI(Finish)
188+
.Start();
189+
189190
}, organization);
190191
}
191192
EditorGUI.EndDisabledGroup();

0 commit comments

Comments
 (0)