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

Commit 6c41270

Browse files
committed
Merge master into features/lock-files-view
2 parents 9d046ef + fa6bc90 commit 6c41270

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+691
-755
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.vs/
22
.idea/
3+
.vscode/
34
packages/
45
_NCrunch_GitHub.Unity
56
*.user

common/SolutionInfo.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
using System.Runtime.InteropServices;
77

88
[assembly: AssemblyProduct("GitHub for Unity")]
9-
[assembly: AssemblyVersion(System.AssemblyVersionInformation.Version)]
10-
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.Version)]
9+
[assembly: AssemblyVersion(System.AssemblyVersionInformation.VersionForAssembly)]
10+
[assembly: AssemblyFileVersion(System.AssemblyVersionInformation.VersionForAssembly)]
1111
[assembly: AssemblyInformationalVersion(System.AssemblyVersionInformation.Version)]
1212
[assembly: ComVisible(false)]
1313
[assembly: AssemblyCompany("GitHub, Inc.")]
@@ -31,6 +31,9 @@
3131
namespace System
3232
{
3333
internal static class AssemblyVersionInformation {
34-
internal const string Version = "0.33.0";
34+
// this is for the AssemblyVersion and AssemblyVersion attributes, which can't handle alphanumerics
35+
internal const string VersionForAssembly = "0.34.1";
36+
// Actual real version
37+
internal const string Version = "0.34.1-beta";
3538
}
3639
}

generate-package.sh

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ if [ $# -ge 7 ]; then
3030
MSG="$7"
3131
fi
3232

33-
EXEC="mono"
33+
EXEC="mono "
3434
if [ -e "/c/" ]; then
3535
EXEC=""
3636
fi
3737

38-
if [ ! -e "$DIR/build/CommandLine/CommandLine.exe" ]; then
38+
if [ ! -e "build/CommandLine/CommandLine.exe" ]; then
3939
>&2 xbuild /target:CommandLine "$DIR/GitHub.Unity.sln" /verbosity:minimal
4040
fi
4141

42-
"$EXEC""$DIR/build/CommandLine/CommandLine.exe" --gen-package --version "$3" --path "$4" --url "$URL" --rn "$RN" --msg "$MSG"
42+
$EXEC build/CommandLine/CommandLine.exe --gen-package --version "$3" --path "$4" --url "$URL" --rn "$RN" --msg "$MSG"

lib/Mono.Security.dll

Lines changed: 0 additions & 3 deletions
This file was deleted.

run-test-webserver.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ if [ ! -e build/CommandLine/CommandLine.exe ]; then
1313
>&2 xbuild /target:CommandLine GitHub.Unity.sln /verbosity:minimal
1414
fi
1515

16-
"$EXEC"build/CommandLine/CommandLine.exe --web --port $PORT
16+
$EXEC build/CommandLine/CommandLine.exe --web --port $PORT

src/GitHub.Api/Application/ApplicationConfiguration.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@ namespace GitHub.Unity
55
public static class ApplicationConfiguration
66
{
77
public const int DefaultWebTimeout = 3000;
8-
9-
static ApplicationConfiguration()
10-
{
11-
var executingAssembly = typeof(ApplicationConfiguration).Assembly;
12-
AssemblyName = executingAssembly.GetName();
13-
}
14-
15-
/// <summary>
16-
/// The currently executing assembly.
17-
/// </summary>
18-
public static AssemblyName AssemblyName { get; }
19-
208
public static int WebTimeout { get; set; } = DefaultWebTimeout;
219
}
2210
}

src/GitHub.Api/Application/ApplicationManagerBase.cs

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ protected void Initialize()
4242
Platform = new Platform(Environment);
4343

4444
LogHelper.TracingEnabled = UserSettings.Get(Constants.TraceLoggingKey, false);
45+
ApplicationConfiguration.WebTimeout = UserSettings.Get(Constants.WebTimeoutKey, ApplicationConfiguration.WebTimeout);
4546
ProcessManager = new ProcessManager(Environment, Platform.GitEnvironment, CancellationToken);
4647
Platform.Initialize(ProcessManager, TaskManager);
4748
GitClient = new GitClient(Environment, ProcessManager, TaskManager.Token);
@@ -56,7 +57,7 @@ public void Run()
5657
GitInstallationState state = new GitInstallationState();
5758
try
5859
{
59-
SetupMetrics(Environment.UnityVersion, instanceId);
60+
SetupMetrics(Environment.UnityVersion);
6061

6162
if (Environment.IsMac)
6263
{
@@ -163,34 +164,18 @@ public void SetupGit(GitInstaller.GitInstallationState state)
163164

164165
if (firstRun)
165166
{
166-
var unityYamlMergeExec = Environment.UnityApplicationContents.Combine("Tools", "UnityYAMLMerge" + Environment.ExecutableExtension);
167-
168-
var yamlMergeCommand = Environment.IsWindows
169-
? $@"'{unityYamlMergeExec}' merge -p ""$BASE"" ""$REMOTE"" ""$LOCAL"" ""$MERGED"""
170-
: $@"'{unityYamlMergeExec}' merge -p '$BASE' '$REMOTE' '$LOCAL' '$MERGED'";
171-
172-
GitClient.SetConfig("merge.unityyamlmerge.cmd", yamlMergeCommand, GitConfigSource.Local)
173-
.Catch(e =>
174-
{
175-
Logger.Error(e, "Error setting merge.unityyamlmerge.cmd");
176-
return true;
177-
})
178-
.RunWithReturn(true);
179-
GitClient.SetConfig("merge.unityyamlmerge.trustExitCode", "false", GitConfigSource.Local)
180-
.Catch(e =>
181-
{
182-
Logger.Error(e, "Error setting merge.unityyamlmerge.trustExitCode");
183-
return true;
184-
})
185-
.RunWithReturn(true);
167+
if (Environment.RepositoryPath.IsInitialized)
168+
{
169+
ConfigureMergeSettings();
186170

187-
GitClient.LfsInstall()
188-
.Catch(e =>
189-
{
190-
Logger.Error(e, "Error running lfs install");
191-
return true;
192-
})
193-
.RunWithReturn(true);
171+
GitClient.LfsInstall()
172+
.Catch(e =>
173+
{
174+
Logger.Error(e, "Error running lfs install");
175+
return true;
176+
})
177+
.RunWithReturn(true);
178+
}
194179

195180
if (Environment.IsWindows)
196181
{
@@ -233,6 +218,8 @@ public void InitializeRepository()
233218
var filesForInitialCommit = new List<string> { gitignore, gitAttrs, assetsGitignore };
234219

235220
GitClient.Init().RunWithReturn(true);
221+
222+
ConfigureMergeSettings();
236223
GitClient.LfsInstall().RunWithReturn(true);
237224
AssemblyResources.ToFile(ResourceType.Generic, ".gitignore", targetPath, Environment);
238225
AssemblyResources.ToFile(ResourceType.Generic, ".gitattributes", targetPath, Environment);
@@ -258,6 +245,25 @@ public void InitializeRepository()
258245
thread.Start();
259246
}
260247

248+
private void ConfigureMergeSettings()
249+
{
250+
var unityYamlMergeExec =
251+
Environment.UnityApplicationContents.Combine("Tools", "UnityYAMLMerge" + Environment.ExecutableExtension);
252+
var yamlMergeCommand = Environment.IsWindows
253+
? $@"'{unityYamlMergeExec}' merge -p ""$BASE"" ""$REMOTE"" ""$LOCAL"" ""$MERGED"""
254+
: $@"'{unityYamlMergeExec}' merge -p '$BASE' '$REMOTE' '$LOCAL' '$MERGED'";
255+
256+
GitClient.SetConfig("merge.unityyamlmerge.cmd", yamlMergeCommand, GitConfigSource.Local).Catch(e => {
257+
Logger.Error(e, "Error setting merge.unityyamlmerge.cmd");
258+
return true;
259+
}).RunWithReturn(true);
260+
261+
GitClient.SetConfig("merge.unityyamlmerge.trustExitCode", "false", GitConfigSource.Local).Catch(e => {
262+
Logger.Error(e, "Error setting merge.unityyamlmerge.trustExitCode");
263+
return true;
264+
}).RunWithReturn(true);
265+
}
266+
261267
public void RestartRepository()
262268
{
263269
if (!Environment.RepositoryPath.IsInitialized)
@@ -273,7 +279,7 @@ public void RestartRepository()
273279
Logger.Trace($"Got a repository? {(Environment.Repository != null ? Environment.Repository.LocalPath : "null")}");
274280
}
275281

276-
protected void SetupMetrics(string unityVersion, Guid instanceId)
282+
protected void SetupMetrics(string unityVersion)
277283
{
278284
string userId = null;
279285
if (UserSettings.Exists(Constants.GuidKey))
@@ -294,7 +300,7 @@ protected void SetupMetrics(string unityVersion, Guid instanceId)
294300
Environment.NodeJsExecutablePath,
295301
Environment.OctorunScriptPath);
296302

297-
UsageTracker = new UsageTracker(metricsService, UserSettings, Environment, userId, unityVersion, instanceId.ToString());
303+
UsageTracker = new UsageTracker(metricsService, UserSettings, Environment, userId, unityVersion, InstanceId.ToString());
298304

299305
if (firstRun)
300306
{

src/GitHub.Api/GitHub.Api.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@
6363
<Reference Include="ICSharpCode.SharpZipLib">
6464
<HintPath>$(SolutionDir)lib\ICSharpCode.SharpZipLib.dll</HintPath>
6565
</Reference>
66-
<Reference Include="Mono.Security">
67-
<HintPath>$(SolutionDir)lib\Mono.Security.dll</HintPath>
68-
</Reference>
6966
<Reference Include="Mono.Posix">
7067
<HintPath>$(SolutionDir)lib\Mono.Posix.dll</HintPath>
7168
</Reference>

src/GitHub.Api/IO/FileSystem.cs

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ public string GetFileNameWithoutExtension(string fileName)
143143
return Path.GetFileNameWithoutExtension(fileName);
144144
}
145145

146+
146147
public IEnumerable<string> GetFiles(string path)
147148
{
148-
return Directory.GetFiles(path);
149+
return GetFiles(path, "*");
149150
}
150151

151152
public IEnumerable<string> GetFiles(string path, string pattern)
@@ -155,7 +156,43 @@ public IEnumerable<string> GetFiles(string path, string pattern)
155156

156157
public IEnumerable<string> GetFiles(string path, string pattern, SearchOption searchOption)
157158
{
158-
return Directory.GetFiles(path, pattern, searchOption);
159+
foreach (var file in GetFiles(path, pattern))
160+
yield return file;
161+
162+
if (searchOption != SearchOption.AllDirectories)
163+
yield break;
164+
165+
#if ENABLE_MONO
166+
if (NPath.IsLinux)
167+
{
168+
try
169+
{
170+
path = Mono.Unix.UnixPath.GetCompleteRealPath(path);
171+
}
172+
catch
173+
{}
174+
}
175+
#endif
176+
foreach (var dir in GetDirectories(path))
177+
{
178+
var realdir = dir;
179+
#if ENABLE_MONO
180+
if (NPath.IsLinux)
181+
{
182+
try
183+
{
184+
realdir = Mono.Unix.UnixPath.GetCompleteRealPath(dir);
185+
}
186+
catch
187+
{}
188+
}
189+
#endif
190+
if (path != realdir)
191+
{
192+
foreach (var file in GetFiles(dir, pattern, searchOption))
193+
yield return file;
194+
}
195+
}
159196
}
160197

161198
public byte[] ReadAllBytes(string path)

src/GitHub.Api/IO/NiceIO.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,9 @@ public override int GetHashCode()
476476
hash = hash * 23 + _isInitialized.GetHashCode();
477477
hash = hash * 23 + _isRelative.GetHashCode();
478478
foreach (var element in _elements)
479-
hash = hash * 23 + (IsLinux ? element : element.ToUpperInvariant()).GetHashCode();
479+
hash = hash * 23 + (IsUnix ? element : element.ToUpperInvariant()).GetHashCode();
480480
if (_driveLetter != null)
481-
hash = hash * 23 + (IsLinux ? _driveLetter : _driveLetter.ToUpperInvariant()).GetHashCode();
481+
hash = hash * 23 + (IsUnix ? _driveLetter : _driveLetter.ToUpperInvariant()).GetHashCode();
482482
return hash;
483483
}
484484
}
@@ -1087,14 +1087,14 @@ public static IFileSystem FileSystem
10871087
}
10881088
}
10891089

1090-
private static bool? _isLinux;
1091-
internal static bool IsLinux
1090+
private static bool? _isUnix;
1091+
internal static bool IsUnix
10921092
{
10931093
get
10941094
{
1095-
if (!_isLinux.HasValue)
1096-
_isLinux = FileSystem.DirectoryExists("/proc");
1097-
return _isLinux.Value;
1095+
if (!_isUnix.HasValue)
1096+
_isUnix = Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix;
1097+
return _isUnix.Value;
10981098
}
10991099
}
11001100

@@ -1103,10 +1103,10 @@ private static StringComparison PathStringComparison
11031103
{
11041104
get
11051105
{
1106-
// this is lazily evaluated because IsLinux uses the FileSystem object and that can be set
1106+
// this is lazily evaluated because IsUnix uses the FileSystem object and that can be set
11071107
// after static constructors happen here
11081108
if (!_pathStringComparison.HasValue)
1109-
_pathStringComparison = IsLinux ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
1109+
_pathStringComparison = IsUnix ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
11101110
return _pathStringComparison.Value;
11111111
}
11121112
}
@@ -1165,7 +1165,7 @@ public static NPath Resolve(this NPath path)
11651165
{
11661166
// Add a reference to Mono.Posix with an .rsp file in the Assets folder with the line "-r:Mono.Posix.dll" for this to work
11671167
#if ENABLE_MONO
1168-
if (!path.IsInitialized || !NPath.IsLinux /* nothing to resolve on windows */ || path.IsRelative || !path.FileExists())
1168+
if (!path.IsInitialized || !NPath.IsUnix /* nothing to resolve on windows */ || path.IsRelative || !path.FileExists())
11691169
return path;
11701170
return new NPath(Mono.Unix.UnixPath.GetCompleteRealPath(path.ToString()));
11711171
#else

0 commit comments

Comments
 (0)