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

Commit 44116a2

Browse files
Merge branch 'master' into fixes/mac-stranger-things
2 parents 7782fa5 + 1868d98 commit 44116a2

30 files changed

+652
-844
lines changed

GitHub.Unity.sln.DotSettings

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,4 +341,6 @@
341341
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
342342
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
343343
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
344-
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
344+
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
345+
<s:Boolean x:Key="/Default/Environment/UnitTesting/ShadowCopy/@EntryValue">False</s:Boolean>
346+
</wpf:ResourceDictionary>

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Notices
44

5-
From version 0.19 onwards, the location of the plugin has moved to `Assets/Plugins/GitHub`. If you have version 0.18 or lower, you need to delete the `Assets/Editor/GitHub` folder before you install newer versions. You should exit Unity and delete the folder from Explorer/Finder, as Unity will not unload native libraries while it's running.
5+
From version 0.19 onwards, the location of the plugin has moved to `Assets/Plugins/GitHub`. If you have version 0.18 or lower, you need to delete the `Assets/Editor/GitHub` folder before you install newer versions. You should exit Unity and delete the folder from Explorer/Finder, as Unity will not unload native libraries while it's running. Also, remember to update your `.gitignore` file.
66

77
![Build Status](https://ci.appveyor.com/api/projects/status/github/github-for-unity/Unity?branch=master&svg=true)
88

@@ -81,7 +81,11 @@ Once the extension is installed, you can open a command line with the same Git a
8181

8282
### Installation
8383

84-
To install the extension, download the latest package from [the releases page](https://github.com/github-for-unity/Unity/releases) and double click on it.
84+
This extensions needs to be installed (and updated) for each Unity project that you want to version control.
85+
First step is to download the latest package from [the releases page](https://github.com/github-for-unity/Unity/releases);
86+
it will be saved as a file with the extension `.unitypackage`.
87+
To install it, open Unity, then open the project you want to version control, and then double click on the downloaded package.
88+
Alternatively, import the package by clicking Assets, Import Package, Custom Package, then select the downloaded package.
8589

8690
#### Log files
8791

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.19.0";
34+
internal const string Version = "0.20.0";
3535
}
3636
}

src/GitHub.Api/Git/GitConfig.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,11 @@ public IEnumerable<ConfigRemote> GetRemotes()
8686
return groups
8787
.Where(x => x.Key == "remote")
8888
.SelectMany(x => x.Value)
89+
.Where(x => x.Value.TryGetString("url") != null)
8990
.Select(x => new ConfigRemote
9091
{
9192
Name = x.Key,
92-
Url = x.Value.GetString("url")
93+
Url = x.Value.TryGetString("url")
9394
});
9495
}
9596

@@ -98,7 +99,7 @@ public IEnumerable<ConfigRemote> GetRemotes()
9899
return groups
99100
.Where(x => x.Key == "remote")
100101
.SelectMany(x => x.Value)
101-
.Where(x => x.Key == remote)
102+
.Where(x => x.Key == remote && x.Value.TryGetString("url") != null)
102103
.Select(x => new ConfigRemote
103104
{
104105
Name = x.Key,

src/GitHub.Api/Git/IRepository.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ interface IRepository : IEquatable<IRepository>
1010
{
1111
void Initialize(IRepositoryManager repositoryManager);
1212
void Refresh();
13+
ITask CommitAllFiles(string message, string body);
14+
ITask CommitFiles(List<string> files, string message, string body);
1315
ITask SetupRemote(string remoteName, string remoteUrl);
16+
ITask<List<GitLogEntry>> Log();
1417
ITask Pull();
1518
ITask Push();
1619
ITask Fetch();

src/GitHub.Api/Git/Repository.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Diagnostics;
44
using System.Globalization;
55
using System.Linq;
6+
using System.Threading;
67

78
namespace GitHub.Unity
89
{
@@ -78,6 +79,24 @@ public ITask SetupRemote(string remote, string remoteUrl)
7879
}
7980
}
8081

82+
public ITask<List<GitLogEntry>> Log()
83+
{
84+
if (repositoryManager == null)
85+
return new FuncListTask<GitLogEntry>(TaskHelpers.GetCompletedTask(new List<GitLogEntry>()));
86+
87+
return repositoryManager.Log();
88+
}
89+
90+
public ITask CommitAllFiles(string message, string body)
91+
{
92+
return repositoryManager.CommitAllFiles(message, body);
93+
}
94+
95+
public ITask CommitFiles(List<string> files, string message, string body)
96+
{
97+
return repositoryManager.CommitFiles(files, message, body);
98+
}
99+
81100
public ITask Pull()
82101
{
83102
return repositoryManager.Pull(CurrentRemote.Value.Name, CurrentBranch?.Name);

src/GitHub.Api/Git/RepositoryManager.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ interface IRepositoryManager : IDisposable
2828
void Start();
2929
void Stop();
3030
void Refresh();
31+
ITask CommitAllFiles(string message, string body);
3132
ITask CommitFiles(List<string> files, string message, string body);
33+
ITask<List<GitLogEntry>> Log();
3234
ITask Fetch(string remote);
3335
ITask Pull(string remote, string branch);
3436
ITask Push(string remote, string branch);
@@ -191,6 +193,15 @@ public void Refresh()
191193
UpdateGitStatus();
192194
}
193195

196+
public ITask CommitAllFiles(string message, string body)
197+
{
198+
var add = GitClient.AddAll();
199+
add.OnStart += t => IsBusy = true;
200+
return add
201+
.Then(GitClient.Commit(message, body))
202+
.Finally(() => IsBusy = false);
203+
}
204+
194205
public ITask CommitFiles(List<string> files, string message, string body)
195206
{
196207
var add = GitClient.Add(files);
@@ -200,6 +211,13 @@ public ITask CommitFiles(List<string> files, string message, string body)
200211
.Finally(() => IsBusy = false);
201212
}
202213

214+
public ITask<List<GitLogEntry>> Log()
215+
{
216+
var task = GitClient.Log();
217+
HookupHandlers(task);
218+
return task;
219+
}
220+
203221
public ITask Fetch(string remote)
204222
{
205223
var task = GitClient.Fetch(remote);

src/GitHub.Api/Git/Tasks/GitStatusTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public GitStatusTask(IGitObjectFactory gitObjectFactory,
1515

1616
public override string ProcessArguments
1717
{
18-
get { return "-c i18n.logoutputencoding=utf8 -c core.quotepath=false status -b -u --ignored --porcelain"; }
18+
get { return "-c i18n.logoutputencoding=utf8 -c core.quotepath=false status -b -u --porcelain"; }
1919
}
2020
public override TaskAffinity Affinity { get { return TaskAffinity.Exclusive; } }
2121
}

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
<Compile Include="Helpers\Constants.cs" />
110110
<Compile Include="Cache\IBranchCache.cs" />
111111
<Compile Include="Helpers\Validation.cs" />
112+
<Compile Include="Helpers\TaskHelpers.cs" />
112113
<Compile Include="Platform\DefaultEnvironment.cs" />
113114
<Compile Include="Extensions\EnvironmentExtensions.cs" />
114115
<Compile Include="Extensions\FileEventExtensions.cs" />

src/GitHub.Api/Helpers/TaskHelpers.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Threading.Tasks;
2+
3+
namespace GitHub.Unity
4+
{
5+
static class TaskHelpers
6+
{
7+
public static Task<T> GetCompletedTask<T>(T result)
8+
{
9+
return TaskEx.FromResult(result);
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)