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

Commit 9795562

Browse files
committed
Use lfs from a custom git path if it's there, install if it's missing
1 parent 0e89896 commit 9795562

File tree

14 files changed

+292
-162
lines changed

14 files changed

+292
-162
lines changed

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fi
2929
if [ x"$OS" == x"Windows" ]; then
3030
common/nuget restore GitHub.Unity.sln
3131
else
32-
nuget restore GitHub.Unity.sln
32+
mono common/nuget.exe restore GitHub.Unity.sln
3333
fi
3434

3535
xbuild GitHub.Unity.sln /verbosity:minimal /property:Configuration=$Configuration /target:$Target || true

src/GitHub.Api/Application/ApplicationManagerBase.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public ITask InitializeRepository()
9494

9595
var filesForInitialCommit = new List<string> { gitignore, gitAttrs, assetsGitignore };
9696

97-
var task =
97+
var task =
9898
GitClient.Init()
9999
.Then(GitClient.SetConfig("merge.unityyamlmerge.cmd", yamlMergeCommand, GitConfigSource.Local))
100100
.Then(GitClient.SetConfig("merge.unityyamlmerge.trustExitCode", "false", GitConfigSource.Local))
@@ -203,7 +203,7 @@ private void InitializeEnvironment(GitInstaller.GitInstallationState installatio
203203
{
204204
var credHelperTask = GitClient.GetConfig("credential.helper", GitConfigSource.Global);
205205
credHelperTask.OnEnd += (thisTask, credentialHelper, success, exception) =>
206-
{
206+
{
207207
if (!success || string.IsNullOrEmpty(credentialHelper))
208208
{
209209
Logger.Warning("No Windows CredentialHelper found: Setting to wincred");

src/GitHub.Api/Extensions/EnvironmentExtensions.cs

+13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
25

36
namespace GitHub.Unity
47
{
@@ -41,5 +44,15 @@ public static NPath GetAssetPath(this IEnvironment environment, NPath path)
4144

4245
return repositoryPath.Combine(path).MakeAbsolute().RelativeTo(projectPath);
4346
}
47+
48+
public static IEnumerable<NPath> ToNPathList(this string envPath, IEnvironment environment)
49+
{
50+
return envPath
51+
.Split(Path.PathSeparator)
52+
.Where(x => x != null)
53+
.Select(x => environment.ExpandEnvironmentVariables(x.Trim('"', '\'')))
54+
.Where(x => !String.IsNullOrEmpty(x))
55+
.Select(x => x.ToNPath());
56+
}
4457
}
4558
}

src/GitHub.Api/Extensions/StringExtensions.cs

-18
Original file line numberDiff line numberDiff line change
@@ -82,24 +82,6 @@ public static string JoinForAppending(string separator, IEnumerable<string> valu
8282
: string.Empty;
8383
}
8484

85-
public static string RemoveSurroundingQuotes(this string s)
86-
{
87-
Guard.ArgumentNotNull(s, "string");
88-
89-
if (s.Length < 2)
90-
return s;
91-
92-
var quoteCharacters = new[] { '"', '\'' };
93-
char firstCharacter = s[0];
94-
if (!quoteCharacters.Contains(firstCharacter))
95-
return s;
96-
97-
if (firstCharacter != s[s.Length - 1])
98-
return s;
99-
100-
return s.Substring(1, s.Length - 2);
101-
}
102-
10385
public static string RightAfter(this string s, char search)
10486
{
10587
if (s == null) return null;

src/GitHub.Api/Helpers/AssemblyResources.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ public static NPath ToFile(ResourceType resourceType, string resource, NPath des
4343
return destinationPath.Combine(resource).WriteAllBytes(stream.ToByteArray());
4444
}
4545

46-
// check the filesystem
47-
NPath possiblePath = environment.ExtensionInstallPath.Combine(type, os, resource);
48-
if (possiblePath.FileExists())
49-
return possiblePath.Copy(destinationPath.Combine(resource));
50-
46+
if (!Guard.InUnitTestRunner)
47+
{
48+
// check the filesystem
49+
NPath possiblePath = environment.ExtensionInstallPath.Combine(type, os, resource);
50+
if (possiblePath.FileExists())
51+
return possiblePath.Copy(destinationPath.Combine(resource));
52+
}
5153
return NPath.Default;
5254
}
5355
}

src/GitHub.Api/IO/NiceIO.cs

+5
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,16 @@
2727

2828
using System;
2929
using System.Collections.Generic;
30+
using System.Diagnostics;
31+
using System.Globalization;
3032
using System.IO;
3133
using System.Linq;
3234
using System.Text;
3335

3436
namespace GitHub.Unity
3537
{
3638
[Serializable]
39+
[DebuggerDisplay("{DebuggerDisplay,nq}")]
3740
public struct NPath : IEquatable<NPath>, IComparable
3841
{
3942
public static NPath Default;
@@ -1107,6 +1110,8 @@ private static StringComparison PathStringComparison
11071110
return _pathStringComparison.Value;
11081111
}
11091112
}
1113+
1114+
internal string DebuggerDisplay => ToString();
11101115
}
11111116

11121117
public static class Extensions

0 commit comments

Comments
 (0)