diff --git a/.gitignore b/.gitignore
index 2009f0208..9c0b3cdb0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,10 +36,5 @@ _ReSharper*/
*.userprefs
*.swp
*.DotSettings
-#Ignore custom generated files
-LibGit2Sharp/Core/UniqueIdentifier.cs
-LibGit2Sharp/Core/NativeDllName.cs
-!nuget.package/build/
_NCrunch_LibGit2Sharp/
-packages/
diff --git a/.nuget/packages.config b/.nuget/packages.config
deleted file mode 100644
index 57b9c468a..000000000
--- a/.nuget/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/.travis.yml b/.travis.yml
index d09406bbe..25b98d6b8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,31 +2,25 @@
# see travis-ci.org for details
language: csharp
-mono:
- - 4.8.0
+dist: trusty
+dotnet: 1.0.1
+mono: none
os:
- osx
- linux
-env:
- global:
- - MONO_OPTIONS=--debug
-
-install:
- - curl -L -o nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
- - mono nuget.exe restore LibGit2Sharp.sln
-
before_install:
- date -u
- uname -a
- env | sort
-solution: LibGit2Sharp.sln
+install:
+ - git fetch --unshallow
# Build libgit2, LibGit2Sharp and run the tests
script:
- - ./build.libgit2sharp.sh 'LEAKS_IDENTIFYING'
+ - ./buildandtest.sh 'LEAKS_IDENTIFYING'
# Only watch the development branch
branches:
diff --git a/CI/build.msbuild b/CI/build.msbuild
deleted file mode 100644
index d4b0faae4..000000000
--- a/CI/build.msbuild
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
- Release
- $(MSBuildProjectDirectory)\..
- $(RootDir)\LibGit2Sharp.Tests\bin\$(Configuration)
- $(RootDir)\Build
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/CodeGeneration/CodeGeneration.csproj b/CodeGeneration/CodeGeneration.csproj
new file mode 100644
index 000000000..4d9b0f60f
--- /dev/null
+++ b/CodeGeneration/CodeGeneration.csproj
@@ -0,0 +1,12 @@
+
+
+ netstandard1.5
+ $(PackageTargetFallback);portable-net45+win8+wp8+wpa81;
+ false
+ true
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CodeGeneration/OfferFriendlyInteropOverloadsGenerator.cs b/CodeGeneration/OfferFriendlyInteropOverloadsGenerator.cs
new file mode 100644
index 000000000..f1b980f2a
--- /dev/null
+++ b/CodeGeneration/OfferFriendlyInteropOverloadsGenerator.cs
@@ -0,0 +1,310 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using CodeGeneration.Roslyn;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using static System.FormattableString;
+
+namespace CodeGeneration
+{
+ public class OfferFriendlyInteropOverloadsGenerator : ICodeGenerator
+ {
+ private static readonly TypeSyntax IntPtrTypeSyntax = SyntaxFactory.ParseTypeName("IntPtr");
+ private static readonly IdentifierNameSyntax resultLocal = SyntaxFactory.IdentifierName("_result");
+ private static readonly ExpressionSyntax IntPtrZeroExpressionSyntax = SyntaxFactory.MemberAccessExpression(
+ SyntaxKind.SimpleMemberAccessExpression,
+ IntPtrTypeSyntax,
+ SyntaxFactory.IdentifierName(nameof(IntPtr.Zero)));
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Generator attribute data.
+ public OfferFriendlyInteropOverloadsGenerator(AttributeData data)
+ {
+ }
+
+ public Task> GenerateAsync(MemberDeclarationSyntax applyTo, CSharpCompilation compilation, IProgress progress, CancellationToken cancellationToken)
+ {
+ Func findMarshalAttribute = (p, al) =>
+ {
+ var marshalAttribute = al.Attributes.FirstOrDefault(a => (a.Name as SimpleNameSyntax)?.Identifier.ValueText == "CustomMarshaler");
+ if (marshalAttribute == null)
+ {
+ return default(MarshaledParameter);
+ }
+
+ var customMarshalerExpression = (TypeOfExpressionSyntax)marshalAttribute.ArgumentList.Arguments[0].Expression;
+ var customMarshaler = customMarshalerExpression.Type;
+ var friendlyTypeExpression = (TypeOfExpressionSyntax)marshalAttribute.ArgumentList.Arguments[1].Expression;
+ var friendlyType = friendlyTypeExpression.Type;
+ return new MarshaledParameter(p, customMarshaler, friendlyType);
+ };
+
+ var semanticModel = compilation.GetSemanticModel(applyTo.SyntaxTree);
+ var type = (ClassDeclarationSyntax)applyTo;
+ var generatedType = type
+ .WithMembers(SyntaxFactory.List())
+ .WithAttributeLists(SyntaxFactory.List());
+ foreach (var method in type.Members.OfType())
+ {
+ var marshaledParameters = from p in method.ParameterList.Parameters
+ from al in p.AttributeLists
+ let a = findMarshalAttribute(p, al)
+ where a.OriginalParameter != null
+ select a;
+ var marshaledResult = from al in method.AttributeLists
+ where al.Target?.Identifier.IsKind(SyntaxKind.ReturnKeyword) ?? false
+ let a = findMarshalAttribute(null, al)
+ where a.FriendlyType != null
+ select a;
+ if (marshaledParameters.Any() || marshaledResult.Any())
+ {
+ var wrapperMethod = method
+ .WithModifiers(RemoveModifier(method.Modifiers, SyntaxKind.ExternKeyword, SyntaxKind.PrivateKeyword).Insert(0, SyntaxFactory.Token(SyntaxKind.InternalKeyword)))
+ .WithAttributeLists(SyntaxFactory.List())
+ .WithLeadingTrivia(method.GetLeadingTrivia().Where(t => !t.IsDirective))
+ .WithTrailingTrivia(method.GetTrailingTrivia().Where(t => !t.IsDirective))
+ .WithParameterList(CreateParameterListFor(method, marshaledParameters))
+ .WithReturnType(marshaledResult.FirstOrDefault().FriendlyType ?? method.ReturnType)
+ .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.None))
+ .WithExpressionBody(null)
+ .WithBody(CreateBodyFor(method, marshaledParameters, marshaledResult.FirstOrDefault()));
+
+ if (!marshaledParameters.Any())
+ {
+ wrapperMethod = wrapperMethod
+ .WithIdentifier(SyntaxFactory.Identifier(wrapperMethod.Identifier.ValueText.TrimEnd('_')));
+ }
+
+ generatedType = generatedType.AddMembers(wrapperMethod);
+ }
+ }
+
+ return Task.FromResult(SyntaxFactory.List().Add(generatedType));
+ }
+
+ private static SyntaxTokenList RemoveModifier(SyntaxTokenList list, params SyntaxKind[] modifiers)
+ {
+ return SyntaxFactory.TokenList(list.Where(t => Array.IndexOf(modifiers, t.Kind()) < 0));
+ }
+
+ private static readonly TypeSyntax ICustomMarshalerTypeSyntax = SyntaxFactory.ParseTypeName("ICustomMarshaler");
+
+ private static ArgumentSyntax ForwardParameter(ParameterSyntax parameter)
+ {
+ var refOrOut = parameter.Modifiers.FirstOrDefault(m => m.IsKind(SyntaxKind.RefKeyword) || m.IsKind(SyntaxKind.OutKeyword));
+ var arg = SyntaxFactory.Argument(SyntaxFactory.IdentifierName(parameter.Identifier))
+ .WithRefOrOutKeyword(refOrOut);
+ return arg;
+ }
+
+ private ParameterListSyntax CreateParameterListFor(MethodDeclarationSyntax innerMethod, IEnumerable marshaledParameters)
+ {
+ var modifiedParameterList = SyntaxFactory.ParameterList();
+
+ foreach (var p in innerMethod.ParameterList.Parameters)
+ {
+ var marshaledInfo = marshaledParameters.FirstOrDefault(m => m.OriginalParameter == p);
+ var modifiedParameter = p
+ .WithAttributeLists(SyntaxFactory.List())
+ .WithType(marshaledInfo.FriendlyType ?? p.Type);
+ modifiedParameterList = modifiedParameterList.AddParameters(modifiedParameter);
+ }
+
+ return modifiedParameterList;
+ }
+
+ private BlockSyntax CreateBodyFor(MethodDeclarationSyntax innerMethod, IEnumerable marshaledParameters, MarshaledParameter marshaledResult)
+ {
+ var body = SyntaxFactory.Block();
+ var finallyBlock = SyntaxFactory.Block();
+ var argsByParameter = innerMethod.ParameterList.Parameters.ToDictionary(
+ p => p,
+ p => ForwardParameter(p));
+ var marshalerInitializers = new List();
+ var inputMarshaling = new List();
+ var outputMarshaling = new List();
+
+ var marshalersCreated = new HashSet();
+ Func acquireMarshaler = type =>
+ {
+ var marshalerLocalName = Invariant($"_{type}");
+ if (marshalersCreated.Add(marshalerLocalName))
+ {
+ marshalerInitializers.Add(
+ SyntaxFactory.LocalDeclarationStatement(
+ SyntaxFactory.VariableDeclaration(ICustomMarshalerTypeSyntax)
+ .AddVariables(SyntaxFactory.VariableDeclarator(marshalerLocalName)
+ .WithInitializer(SyntaxFactory.EqualsValueClause(
+ SyntaxFactory.InvocationExpression(
+ SyntaxFactory.MemberAccessExpression(
+ SyntaxKind.SimpleMemberAccessExpression,
+ type,
+ SyntaxFactory.IdentifierName("GetInstance")),
+ SyntaxFactory.ArgumentList()))))));
+ }
+
+ return marshalerLocalName;
+ };
+
+ foreach (var parameter in marshaledParameters)
+ {
+ string marshalerLocalName = acquireMarshaler(parameter.MarshalerType);
+ var isOutParameter = parameter.OriginalParameter.Modifiers.Any(m => m.IsKind(SyntaxKind.OutKeyword));
+ TypeSyntax localVarType = isOutParameter ? parameter.OriginalParameter.Type : IntPtrTypeSyntax;
+ ExpressionSyntax initialValue = isOutParameter
+ ? (ExpressionSyntax)SyntaxFactory.DefaultExpression(parameter.OriginalParameter.Type)
+ : SyntaxFactory.InvocationExpression(
+ SyntaxFactory.MemberAccessExpression(
+ SyntaxKind.SimpleMemberAccessExpression,
+ SyntaxFactory.IdentifierName(marshalerLocalName),
+ SyntaxFactory.IdentifierName("MarshalManagedToNative")))
+ .AddArgumentListArguments(SyntaxFactory.Argument(SyntaxFactory.IdentifierName(parameter.OriginalParameter.Identifier)));
+ var localVarIdentifier = SyntaxFactory.IdentifierName(Invariant($"_{parameter.OriginalParameter.Identifier.ValueText}"));
+ inputMarshaling.Add(
+ SyntaxFactory.LocalDeclarationStatement(
+ SyntaxFactory.VariableDeclaration(localVarType)
+ .AddVariables(SyntaxFactory.VariableDeclarator(localVarIdentifier.Identifier)
+ .WithInitializer(SyntaxFactory.EqualsValueClause(initialValue)))));
+
+ argsByParameter[parameter.OriginalParameter] = argsByParameter[parameter.OriginalParameter]
+ .WithExpression(
+ isOutParameter
+ ? (ExpressionSyntax)localVarIdentifier
+ : SyntaxFactory.CastExpression(parameter.OriginalParameter.Type, localVarIdentifier));
+
+ if (isOutParameter)
+ {
+ outputMarshaling.Add(
+ SyntaxFactory.ExpressionStatement(SyntaxFactory.AssignmentExpression(
+ SyntaxKind.SimpleAssignmentExpression,
+ SyntaxFactory.IdentifierName(parameter.OriginalParameter.Identifier),
+ SyntaxFactory.CastExpression(
+ parameter.FriendlyType,
+ SyntaxFactory.InvocationExpression(
+ SyntaxFactory.MemberAccessExpression(
+ SyntaxKind.SimpleMemberAccessExpression,
+ SyntaxFactory.IdentifierName(marshalerLocalName),
+ SyntaxFactory.IdentifierName("MarshalNativeToManaged")),
+ SyntaxFactory.ArgumentList(SyntaxFactory.SingletonSeparatedList(SyntaxFactory.Argument(
+ SyntaxFactory.ObjectCreationExpression(
+ IntPtrTypeSyntax,
+ SyntaxFactory.ArgumentList(SyntaxFactory.SingletonSeparatedList(SyntaxFactory.Argument(localVarIdentifier))),
+ null)))))))));
+ }
+
+ var cleanUpExpression = isOutParameter
+ ? (ExpressionSyntax)SyntaxFactory.ObjectCreationExpression(IntPtrTypeSyntax).AddArgumentListArguments(
+ SyntaxFactory.Argument(localVarIdentifier))
+ : localVarIdentifier;
+ finallyBlock = finallyBlock.AddStatements(
+ SyntaxFactory.ExpressionStatement(SyntaxFactory.InvocationExpression(
+ SyntaxFactory.MemberAccessExpression(
+ SyntaxKind.SimpleMemberAccessExpression,
+ SyntaxFactory.IdentifierName(marshalerLocalName),
+ SyntaxFactory.IdentifierName("CleanUpNativeData")))
+ .AddArgumentListArguments(SyntaxFactory.Argument(cleanUpExpression))));
+ }
+
+ var args = SyntaxFactory.ArgumentList().AddArguments(
+ (from p in innerMethod.ParameterList.Parameters
+ select argsByParameter[p]).ToArray());
+ var invocation = SyntaxFactory.InvocationExpression(
+ SyntaxFactory.IdentifierName(innerMethod.Identifier),
+ args);
+ StatementSyntax invocationStatement;
+ StatementSyntax returnStatement = null;
+ if (innerMethod.ReturnType != null && (innerMethod.ReturnType as PredefinedTypeSyntax)?.Keyword.Kind() != SyntaxKind.VoidKeyword)
+ {
+ if (marshaledResult.MarshalerType != null)
+ {
+ string marshalerLocalName = acquireMarshaler(marshaledResult.MarshalerType);
+ inputMarshaling.Add(
+ SyntaxFactory.LocalDeclarationStatement(
+ SyntaxFactory.VariableDeclaration(IntPtrTypeSyntax)
+ .AddVariables(SyntaxFactory.VariableDeclarator(resultLocal.Identifier)
+ .WithInitializer(SyntaxFactory.EqualsValueClause(IntPtrZeroExpressionSyntax)))));
+
+ var intPtrResultExpression = SyntaxFactory.AssignmentExpression(
+ SyntaxKind.SimpleAssignmentExpression,
+ resultLocal,
+ SyntaxFactory.ObjectCreationExpression(
+ IntPtrTypeSyntax,
+ SyntaxFactory.ArgumentList(SyntaxFactory.SingletonSeparatedList(SyntaxFactory.Argument(invocation))),
+ null));
+ var castToManagedExpression = SyntaxFactory.CastExpression(
+ marshaledResult.FriendlyType,
+ SyntaxFactory.InvocationExpression(
+ SyntaxFactory.MemberAccessExpression(
+ SyntaxKind.SimpleMemberAccessExpression,
+ SyntaxFactory.IdentifierName(marshalerLocalName),
+ SyntaxFactory.IdentifierName("MarshalNativeToManaged")),
+ SyntaxFactory.ArgumentList(SyntaxFactory.SingletonSeparatedList(SyntaxFactory.Argument(resultLocal)))));
+
+ invocationStatement = SyntaxFactory.ExpressionStatement(intPtrResultExpression);
+ returnStatement = SyntaxFactory.ReturnStatement(castToManagedExpression);
+
+ finallyBlock = finallyBlock.AddStatements(
+ SyntaxFactory.ExpressionStatement(SyntaxFactory.InvocationExpression(
+ SyntaxFactory.MemberAccessExpression(
+ SyntaxKind.SimpleMemberAccessExpression,
+ SyntaxFactory.IdentifierName(marshalerLocalName),
+ SyntaxFactory.IdentifierName("CleanUpNativeData")))
+ .AddArgumentListArguments(SyntaxFactory.Argument(resultLocal))));
+ }
+ else
+ {
+ invocationStatement = SyntaxFactory.LocalDeclarationStatement(
+ SyntaxFactory.VariableDeclaration(innerMethod.ReturnType)
+ .AddVariables(SyntaxFactory.VariableDeclarator(resultLocal.Identifier)
+ .WithInitializer(SyntaxFactory.EqualsValueClause(invocation))));
+ returnStatement = SyntaxFactory.ReturnStatement(resultLocal);
+ }
+ }
+ else
+ {
+ invocationStatement = SyntaxFactory.ExpressionStatement(invocation);
+ }
+
+ var tryBlock = SyntaxFactory.Block()
+ .AddStatements(invocationStatement)
+ .AddStatements(outputMarshaling.ToArray());
+
+ if (returnStatement != null)
+ {
+ tryBlock = tryBlock
+ .AddStatements(returnStatement);
+ }
+
+ body = body
+ .AddStatements(marshalerInitializers.ToArray())
+ .AddStatements(inputMarshaling.ToArray())
+ .AddStatements(SyntaxFactory.TryStatement(tryBlock, SyntaxFactory.List(), SyntaxFactory.FinallyClause(finallyBlock)));
+
+ return body;
+ }
+
+ private struct MarshaledParameter
+ {
+ internal MarshaledParameter(ParameterSyntax originalParameter, TypeSyntax marshalerType, TypeSyntax friendlyType)
+ {
+ this.OriginalParameter = originalParameter;
+ this.MarshalerType = marshalerType;
+ this.FriendlyType = friendlyType;
+ }
+
+ internal ParameterSyntax OriginalParameter { get; }
+
+ internal TypeSyntax MarshalerType { get; }
+
+ internal TypeSyntax FriendlyType { get; }
+ }
+ }
+}
diff --git a/CodeGenerationAttributes/CodeGenerationAttributes.csproj b/CodeGenerationAttributes/CodeGenerationAttributes.csproj
new file mode 100644
index 000000000..4f81e364c
--- /dev/null
+++ b/CodeGenerationAttributes/CodeGenerationAttributes.csproj
@@ -0,0 +1,12 @@
+
+
+ net40;netstandard1.0
+ true
+ ..\libgit2sharp.snk
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CodeGenerationAttributes/CustomMarshalerAttribute.cs b/CodeGenerationAttributes/CustomMarshalerAttribute.cs
new file mode 100644
index 000000000..549dd1241
--- /dev/null
+++ b/CodeGenerationAttributes/CustomMarshalerAttribute.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+
+namespace LibGit2Sharp
+{
+ [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false)]
+ [Conditional("CodeGeneration")]
+ public class CustomMarshalerAttribute : Attribute
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The type that derives from ICustomMarshaler.
+ /// The type to expose in the generated overload.
+ public CustomMarshalerAttribute(Type customMarshaler, Type friendlyType)
+ {
+ }
+ }
+}
diff --git a/CodeGenerationAttributes/OfferFriendlyInteropOverloadsAttribute.cs b/CodeGenerationAttributes/OfferFriendlyInteropOverloadsAttribute.cs
new file mode 100644
index 000000000..6aae514a3
--- /dev/null
+++ b/CodeGenerationAttributes/OfferFriendlyInteropOverloadsAttribute.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Diagnostics;
+using CodeGeneration.Roslyn;
+
+namespace LibGit2Sharp
+{
+ ///
+ /// Causes generation of an overload of a P/Invoke method that has a more friendly signature.
+ ///
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
+ [CodeGenerationAttribute("CodeGeneration.OfferFriendlyInteropOverloadsGenerator, CodeGeneration, Version=" + ThisAssembly.AssemblyVersion + ", Culture=neutral, PublicKeyToken=null")]
+ [Conditional("CodeGeneration")]
+ public class OfferFriendlyInteropOverloadsAttribute : Attribute
+ {
+ }
+}
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 000000000..7bf63e22b
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,12 @@
+
+
+ $(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\
+ $(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\
+
+ 0.3.13-gfce1c8ba1e
+
+
+
+
+
+
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 000000000..f7c1901a8
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,5 @@
+
+
+ true
+
+
diff --git a/Lib/.gitattributes b/Lib/.gitattributes
deleted file mode 100644
index 2fa88711b..000000000
--- a/Lib/.gitattributes
+++ /dev/null
@@ -1,3 +0,0 @@
-* binary
-.gitattributes text -binary
-*.txt text -binary
diff --git a/Lib/CustomBuildTasks/CustomBuildTasks.csproj b/Lib/CustomBuildTasks/CustomBuildTasks.csproj
deleted file mode 100644
index 351e4873f..000000000
--- a/Lib/CustomBuildTasks/CustomBuildTasks.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {B6138573-A4B9-44E7-83C2-8964CAF51EDA}
- Library
- Properties
- CustomBuildTasks
- CustomBuildTasks
- v4.0
- 512
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Lib/CustomBuildTasks/CustomBuildTasks.dll b/Lib/CustomBuildTasks/CustomBuildTasks.dll
deleted file mode 100644
index cd763a2e1..000000000
Binary files a/Lib/CustomBuildTasks/CustomBuildTasks.dll and /dev/null differ
diff --git a/Lib/CustomBuildTasks/GenerateNativeDllNameTask.cs b/Lib/CustomBuildTasks/GenerateNativeDllNameTask.cs
deleted file mode 100644
index 9b31fba34..000000000
--- a/Lib/CustomBuildTasks/GenerateNativeDllNameTask.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.IO;
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace CustomBuildTasks
-{
- public class GenerateNativeDllNameTask : Task
- {
- public ITaskItem InputHashFile { get; set; }
-
- public string OutputFile { get; set; }
-
- public override bool Execute()
- {
- var fileName = InputHashFile.GetMetadata("FullPath");
- string libgit2FileName;
-
- using (var sr = new StreamReader(fileName))
- {
- libgit2FileName = sr.ReadLine();
- }
-
- var nativeDllName = @"namespace LibGit2Sharp.Core
-{{
- internal static class NativeDllName
- {{
- public const string Name = ""{0}"";
- }}
-}}
-";
-
- using (var sw = new StreamWriter(OutputFile))
- {
- sw.Write(nativeDllName, libgit2FileName);
- }
-
- return true;
- }
- }
-}
diff --git a/Lib/CustomBuildTasks/GenerateUniqueIdentifierTask.cs b/Lib/CustomBuildTasks/GenerateUniqueIdentifierTask.cs
deleted file mode 100644
index 2f26ac94d..000000000
--- a/Lib/CustomBuildTasks/GenerateUniqueIdentifierTask.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System;
-using System.IO;
-using System.Text;
-using Microsoft.Build.Framework;
-using Microsoft.Build.Utilities;
-
-namespace CustomBuildTasks
-{
- public class GenerateUniqueIdentifierTask : Task
- {
- public override bool Execute()
- {
- using (FileStream fs = new FileStream(this.OutputFile, FileMode.Create, FileAccess.Write, FileShare.None))
- using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
- {
- sw.WriteLine("using System;");
- sw.WriteLine();
- sw.WriteLine("namespace LibGit2Sharp.Core");
- sw.WriteLine("{");
- sw.WriteLine(" internal static class UniqueId");
- sw.WriteLine(" {");
- sw.WriteLine(" public const String UniqueIdentifier = \"" + Guid.NewGuid().ToString() + "\";");
- sw.WriteLine(" }");
- sw.WriteLine("}");
- }
-
- return true;
- }
-
- public String OutputFile
- {
- get;
- set;
- }
- }
-}
diff --git a/Lib/NuGet/NuGet.exe b/Lib/NuGet/NuGet.exe
deleted file mode 100644
index 66794573f..000000000
Binary files a/Lib/NuGet/NuGet.exe and /dev/null differ
diff --git a/Lib/NuGet/NuGet.license.txt b/Lib/NuGet/NuGet.license.txt
deleted file mode 100644
index 48715cacc..000000000
--- a/Lib/NuGet/NuGet.license.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.
-
-1. Definitions
-
-The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.
-
-A "contribution" is the original software, or any additions or changes to the software.
-
-A "contributor" is any person that distributes its contribution under this license.
-
-"Licensed patents" are a contributor's patent claims that read directly on its contribution.
-
-2. Grant of Rights
-
-(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.
-
-(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.
-
-3. Conditions and Limitations
-
-(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
-
-(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.
-
-(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.
-
-(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.
-
-(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement.
diff --git a/LibGit2Sharp.Tests/ArchiveTarFixture.cs b/LibGit2Sharp.Tests/ArchiveTarFixture.cs
index a21847ea0..247a9a3b0 100644
--- a/LibGit2Sharp.Tests/ArchiveTarFixture.cs
+++ b/LibGit2Sharp.Tests/ArchiveTarFixture.cs
@@ -30,8 +30,8 @@ public void CanArchiveACommitWithDirectoryAsTar()
repo.ObjectDatabase.Archive(commit, archivePath);
- using (var expectedStream = new StreamReader(Path.Combine(ResourcesDirectory.FullName, "expected_archives/commit_with_directory.tar")))
- using (var actualStream = new StreamReader(archivePath))
+ using (var expectedStream = new StreamReader(File.OpenRead(Path.Combine(ResourcesDirectory.FullName, "expected_archives/commit_with_directory.tar"))))
+ using (var actualStream = new StreamReader(File.OpenRead(archivePath)))
{
string expected = expectedStream.ReadToEnd();
string actual = actualStream.ReadToEnd();
diff --git a/LibGit2Sharp.Tests/BranchFixture.cs b/LibGit2Sharp.Tests/BranchFixture.cs
index 2bc65892b..e06e81784 100644
--- a/LibGit2Sharp.Tests/BranchFixture.cs
+++ b/LibGit2Sharp.Tests/BranchFixture.cs
@@ -1113,7 +1113,7 @@ public void TrackedBranchExistsFromDefaultConfigInEmptyClone()
using (var emptyRepo = new Repository(repoPath))
{
- uri = new Uri(emptyRepo.Info.Path);
+ uri = new Uri($"file://{emptyRepo.Info.Path}");
}
SelfCleaningDirectory scd2 = BuildSelfCleaningDirectory();
diff --git a/LibGit2Sharp.Tests/CloneFixture.cs b/LibGit2Sharp.Tests/CloneFixture.cs
index ae98788eb..84fa5f312 100644
--- a/LibGit2Sharp.Tests/CloneFixture.cs
+++ b/LibGit2Sharp.Tests/CloneFixture.cs
@@ -81,7 +81,7 @@ private void AssertLocalClone(string url, string path = null, bool isCloningAnEm
[Fact]
public void CanCloneALocalRepositoryFromALocalUri()
{
- var uri = new Uri(Path.GetFullPath(BareTestRepoPath));
+ var uri = new Uri($"file://{Path.GetFullPath(BareTestRepoPath)}");
AssertLocalClone(uri.AbsoluteUri, BareTestRepoPath);
}
@@ -361,7 +361,7 @@ private class CloneCallbackInfo
[Fact]
public void CanRecursivelyCloneSubmodules()
{
- var uri = new Uri(Path.GetFullPath(SandboxSubmoduleSmallTestRepo()));
+ var uri = new Uri($"file://{Path.GetFullPath(SandboxSubmoduleSmallTestRepo())}");
var scd = BuildSelfCleaningDirectory();
string relativeSubmodulePath = "submodule_target_wd";
@@ -512,7 +512,7 @@ public void CanRecursivelyCloneSubmodules()
[Fact]
public void CanCancelRecursiveClone()
{
- var uri = new Uri(Path.GetFullPath(SandboxSubmoduleSmallTestRepo()));
+ var uri = new Uri($"file://{Path.GetFullPath(SandboxSubmoduleSmallTestRepo())}");
var scd = BuildSelfCleaningDirectory();
string relativeSubmodulePath = "submodule_target_wd";
diff --git a/LibGit2Sharp.Tests/FetchFixture.cs b/LibGit2Sharp.Tests/FetchFixture.cs
index 0689bc47e..6c88317dc 100644
--- a/LibGit2Sharp.Tests/FetchFixture.cs
+++ b/LibGit2Sharp.Tests/FetchFixture.cs
@@ -207,7 +207,7 @@ public void CanFetchAllTagsAfterAnInitialClone()
public void FetchHonorsTheFetchPruneConfigurationEntry()
{
var source = SandboxBareTestRepo();
- var url = new Uri(Path.GetFullPath(source)).AbsoluteUri;
+ var url = new Uri($"file://{Path.GetFullPath(source)}").AbsoluteUri;
var scd = BuildSelfCleaningDirectory();
diff --git a/LibGit2Sharp.Tests/GlobalSettingsFixture.cs b/LibGit2Sharp.Tests/GlobalSettingsFixture.cs
index 8055a98d1..8d93373de 100644
--- a/LibGit2Sharp.Tests/GlobalSettingsFixture.cs
+++ b/LibGit2Sharp.Tests/GlobalSettingsFixture.cs
@@ -19,41 +19,26 @@ public void CanGetMinimumCompiledInFeatures()
public void CanRetrieveValidVersionString()
{
// Version string format is:
- // Major.Minor.Patch[-preDateTime]-LibGit2Sharp_abbrev_hash-libgit2_abbrev_hash (x86|x64 - features)
+ // Major.Minor.Patch[-somePreleaseTag]-libgit2_abbrev_hash (x86|x64 - features)
// Example output:
- // "0.17.0[-pre20170914123547]-deadcafe-06d772d (x86 - Threads, Https)"
+ // "0.17.0[-beta]+gdeadcafeee.LibGit2-06d772d (x86 - Threads, Https)"
string versionInfo = GlobalSettings.Version.ToString();
// The GlobalSettings.Version returned string should contain :
- // version: '0.17.0[-pre20170914123547]' LibGit2Sharp version number.
- // git2SharpHash:'unknown' ( when compiled from source ) else LibGit2Sharp library hash.
+ // version: '0.17.0[-somePreleaseTag]+[gSomeGitCommit.]LibGit2-06d772d' LibGit2Sharp version number.
// git2hash: '06d772d' LibGit2 library hash.
// arch: 'x86' or 'x64' LibGit2 target.
// git2Features: 'Threads, Ssh' LibGit2 features compiled with.
- string regex = @"^(?\d{1,}\.\d{1,2}\.\d{1,3}(-(pre|dev)\d{14})?)-(?\w+)-(?\w+) \((?\w+) - (?(?:\w*(?:, )*\w+)*)\)$";
+ string regex = @"^(?\d+\.\d+\.\d+(-\w+)?\+(g(?[a-f0-9]{10})\.)?LibGit2-[a-f0-9]{7}) \((?\w+) - (?(?:\w*(?:, )*\w+)*)\)$";
Assert.NotNull(versionInfo);
Match regexResult = Regex.Match(versionInfo, regex);
Assert.True(regexResult.Success, "The following version string format is enforced:" +
- "Major.Minor.Patch[-preDateTime]-LibGit2Sharp_abbrev_hash-libgit2_abbrev_hash (x86|x64 - features)");
-
- GroupCollection matchGroups = regexResult.Groups;
-
- Assert.Equal(8, matchGroups.Count);
-
- // Check that all groups are valid
- for (int i = 0; i < matchGroups.Count; i++)
- {
- if (i == 1 || i == 2) // '-pre' segment is optional
- {
- continue;
- }
-
- Assert.True(matchGroups[i].Success);
- }
+ "Major.Minor.Patch[-somePreleaseTag]+[gSomeGitCommit].LibGit2-abbrev_hash (x86|x64 - features). " +
+ "But found \"" + versionInfo + "\" instead.");
}
[Fact]
diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj
index eee61b802..b84f5399b 100644
--- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj
+++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj
@@ -1,73 +1,10 @@
-
-
-
+
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {286E63EB-04DD-4ADE-88D6-041B57800761}
- Library
- Properties
- LibGit2Sharp.Tests
- LibGit2Sharp.Tests
- v4.6
- 512
-
-
-
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;NET40
- prompt
- 4
- true
- false
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
+ net46;netcoreapp1.0
true
- false
+ $(DefineConstants);DESKTOP
+ false
-
-
- ..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll
-
-
- ..\packages\Moq.4.7.8\lib\net45\Moq.dll
-
-
-
-
-
- ..\packages\Validation.2.4.15\lib\net45\Validation.dll
-
-
- ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll
- True
-
-
- ..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll
-
-
- ..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll
-
-
- ..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll
-
-
- ..\packages\Xunit.SkippableFact.1.3.1\lib\net452\Xunit.SkippableFact.dll
-
-
TestHelpers\Epoch.cs
@@ -75,114 +12,21 @@
TestHelpers\Platform.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
- {EE6ED99F-CB12-4683-B055-D28FC7357A34}
- LibGit2Sharp
-
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
\ No newline at end of file
diff --git a/LibGit2Sharp.Tests/MetaFixture.cs b/LibGit2Sharp.Tests/MetaFixture.cs
index a3ff18f78..64e232076 100644
--- a/LibGit2Sharp.Tests/MetaFixture.cs
+++ b/LibGit2Sharp.Tests/MetaFixture.cs
@@ -13,7 +13,7 @@
namespace LibGit2Sharp.Tests
{
- public class MetaFixture
+ public partial class MetaFixture
{
private static readonly HashSet explicitOnlyInterfaces = new HashSet
{
@@ -28,8 +28,8 @@ public void PublicTestMethodsAreFactsOrTheories()
"LibGit2Sharp.Tests.FilterBranchFixture.Dispose",
};
- var fixtures = from t in Assembly.GetAssembly(typeof(MetaFixture)).GetExportedTypes()
- where t.IsPublic && !t.IsNested
+ var fixtures = from t in typeof(MetaFixture).GetTypeInfo().Assembly.GetExportedTypes()
+ where t.GetTypeInfo().IsPublic && !t.IsNested
where t.Namespace != typeof(BaseFixture).Namespace // Exclude helpers
let methods = t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)
from m in methods
@@ -49,12 +49,12 @@ public void TypesInLibGit2DecoratedWithDebuggerDisplayMustFollowTheStandardImplP
{
var typesWithDebuggerDisplayAndInvalidImplPattern = new List();
- IEnumerable libGit2SharpTypes = Assembly.GetAssembly(typeof(IRepository)).GetExportedTypes()
- .Where(t => t.GetCustomAttributes(typeof(DebuggerDisplayAttribute), false).Any());
+ IEnumerable libGit2SharpTypes = typeof(IRepository).GetTypeInfo().Assembly.GetExportedTypes()
+ .Where(t => t.GetTypeInfo().GetCustomAttributes(typeof(DebuggerDisplayAttribute), false).Any());
foreach (Type type in libGit2SharpTypes)
{
- var debuggerDisplayAttribute = (DebuggerDisplayAttribute)type.GetCustomAttributes(typeof(DebuggerDisplayAttribute), false).Single();
+ var debuggerDisplayAttribute = (DebuggerDisplayAttribute)type.GetTypeInfo().GetCustomAttributes(typeof(DebuggerDisplayAttribute), false).Single();
if (debuggerDisplayAttribute.Value != "{DebuggerDisplay,nq}")
{
@@ -89,12 +89,12 @@ public void TypesInLibGit2SharpMustBeExtensibleInATestingContext()
{
var nonTestableTypes = new Dictionary>();
- IEnumerable libGit2SharpTypes = Assembly.GetAssembly(typeof(IRepository)).GetExportedTypes()
+ IEnumerable libGit2SharpTypes = typeof(IRepository).GetTypeInfo().Assembly.GetExportedTypes()
.Where(t => MustBeMockable(t) && t.Namespace == typeof(IRepository).Namespace);
foreach (Type type in libGit2SharpTypes)
{
- if (type.IsInterface || type.IsEnum || IsStatic(type))
+ if (type.GetTypeInfo().IsInterface || type.GetTypeInfo().IsEnum || IsStatic(type))
continue;
var nonVirtualMethodNamesForType = GetNonVirtualPublicMethodsNames(type).ToList();
@@ -109,14 +109,14 @@ public void TypesInLibGit2SharpMustBeExtensibleInATestingContext()
nonTestableTypes.Add(type, new List());
}
- if (type.IsAbstract)
+ if (type.GetTypeInfo().IsAbstract)
{
continue;
}
try
{
- if (type.ContainsGenericParameters)
+ if (type.GetTypeInfo().ContainsGenericParameters)
{
var constructType = type.MakeGenericType(Enumerable.Repeat(typeof(object), type.GetGenericArguments().Length).ToArray());
Activator.CreateInstance(constructType, true);
@@ -140,62 +140,27 @@ public void TypesInLibGit2SharpMustBeExtensibleInATestingContext()
private static bool MustBeMockable(Type type)
{
- if (type.IsSealed)
+ if (type.GetTypeInfo().IsSealed)
{
return false;
}
- if (type.IsAbstract)
+ if (type.GetTypeInfo().IsAbstract)
{
- return !type.Assembly.GetExportedTypes()
- .Where(t => t.IsSubclassOf(type))
- .All(t => t.IsAbstract || t.IsSealed);
+ return !type.GetTypeInfo().Assembly.GetExportedTypes()
+ .Where(t => t.GetTypeInfo().IsSubclassOf(type))
+ .All(t => t.GetTypeInfo().IsAbstract || t.GetTypeInfo().IsSealed);
}
return true;
}
- [Fact]
- public void LibGit2SharpPublicInterfacesCoverAllPublicMembers()
- {
- var methodsMissingFromInterfaces =
- from t in Assembly.GetAssembly(typeof(IRepository)).GetExportedTypes()
- where !t.IsInterface
- where t.GetInterfaces().Any(i => i.IsPublic && i.Namespace == typeof(IRepository).Namespace && !explicitOnlyInterfaces.Contains(i))
- let interfaceTargetMethods = from i in t.GetInterfaces()
- from im in t.GetInterfaceMap(i).TargetMethods
- select im
- from tm in t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance)
- where !interfaceTargetMethods.Contains(tm)
- select t.Name + " has extra method " + tm.Name;
-
- Assert.Equal("", string.Join(Environment.NewLine,
- methodsMissingFromInterfaces.ToArray()));
- }
-
- [Fact]
- public void LibGit2SharpExplicitOnlyInterfacesAreIndeedExplicitOnly()
- {
- var methodsMissingFromInterfaces =
- from t in Assembly.GetAssembly(typeof(IRepository)).GetExportedTypes()
- where t.GetInterfaces().Any(explicitOnlyInterfaces.Contains)
- let interfaceTargetMethods = from i in t.GetInterfaces()
- where explicitOnlyInterfaces.Contains(i)
- from im in t.GetInterfaceMap(i).TargetMethods
- select im
- from tm in t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance)
- where interfaceTargetMethods.Contains(tm)
- select t.Name + " has public method " + tm.Name + " which should be explicitly implemented.";
-
- Assert.Equal("", string.Join(Environment.NewLine,
- methodsMissingFromInterfaces.ToArray()));
- }
[Fact]
public void EnumsWithFlagsHaveMutuallyExclusiveValues()
{
- var flagsEnums = Assembly.GetAssembly(typeof(IRepository)).GetExportedTypes()
- .Where(t => t.IsEnum && t.GetCustomAttributes(typeof(FlagsAttribute), false).Any());
+ var flagsEnums = typeof(IRepository).GetTypeInfo().Assembly.GetExportedTypes()
+ .Where(t => t.GetTypeInfo().IsEnum && t.GetTypeInfo().GetCustomAttributes(typeof(FlagsAttribute), false).Any());
var overlaps = from t in flagsEnums
from int x in Enum.GetValues(t)
@@ -259,19 +224,19 @@ private static bool HasEmptyPublicOrProtectedConstructor(Type type)
private static bool IsStatic(Type type)
{
- return type.IsAbstract && type.IsSealed;
+ return type.GetTypeInfo().IsAbstract && type.GetTypeInfo().IsSealed;
}
// Related to https://github.com/libgit2/libgit2sharp/issues/644 and https://github.com/libgit2/libgit2sharp/issues/645
[Fact]
public void GetEnumeratorMethodsInLibGit2SharpMustBeVirtualForTestability()
{
- var nonVirtualGetEnumeratorMethods = Assembly.GetAssembly(typeof(IRepository))
+ var nonVirtualGetEnumeratorMethods = typeof(IRepository).GetTypeInfo().Assembly
.GetExportedTypes()
.Where(t =>
t.Namespace == typeof(IRepository).Namespace &&
- !t.IsSealed &&
- !t.IsAbstract &&
+ !t.GetTypeInfo().IsSealed &&
+ !t.GetTypeInfo().IsAbstract &&
t.GetInterfaces().Any(i => i.IsAssignableFrom(typeof(IEnumerable<>))))
.Select(t => t.GetMethod("GetEnumerator"))
.Where(m =>
@@ -298,7 +263,7 @@ public void NoPublicTypesUnderLibGit2SharpCoreNamespace()
{
const string coreNamespace = "LibGit2Sharp.Core";
- var types = Assembly.GetAssembly(typeof(IRepository))
+ var types = typeof(IRepository).GetTypeInfo().Assembly
.GetExportedTypes()
.Where(t => t.FullName.StartsWith(coreNamespace + "."))
@@ -326,7 +291,7 @@ public void NoPublicTypesUnderLibGit2SharpCoreNamespace()
public void NoOptionalParametersinMethods()
{
IEnumerable mis =
- from t in Assembly.GetAssembly(typeof(IRepository))
+ from t in typeof(IRepository).GetTypeInfo().Assembly
.GetExportedTypes()
from m in t.GetMethods()
where !m.IsObsolete()
@@ -349,7 +314,7 @@ where p.IsOptional
public void NoOptionalParametersinConstructors()
{
IEnumerable mis =
- from t in Assembly.GetAssembly(typeof(IRepository))
+ from t in typeof(IRepository).GetTypeInfo().Assembly
.GetExportedTypes()
from c in t.GetConstructors()
from p in c.GetParameters()
@@ -389,12 +354,12 @@ from m in GetInvalidPublicExtensionMethods()
static IEnumerable GetInvalidPublicExtensionMethods()
{
- var query = from type in (Assembly.GetAssembly(typeof(IRepository))).GetTypes()
- where type.IsSealed && !type.IsGenericType && !type.IsNested && type.IsPublic
+ var query = from type in typeof(IRepository).GetTypeInfo().Assembly.GetTypes()
+ where type.GetTypeInfo().IsSealed && !type.GetTypeInfo().IsGenericType && !type.IsNested && type.GetTypeInfo().IsPublic
from method in type.GetMethods(BindingFlags.Static | BindingFlags.Public)
where method.IsDefined(typeof(ExtensionAttribute), false)
let parameterType = method.GetParameters()[0].ParameterType
- where parameterType != null && !parameterType.IsInterface && !parameterType.IsEnum
+ where parameterType != null && !parameterType.GetTypeInfo().IsInterface && !parameterType.GetTypeInfo().IsEnum
select method;
return query;
}
@@ -405,8 +370,8 @@ public void AllIDiffResultsAreInChangesBuilder()
var diff = typeof(Diff).GetField("ChangesBuilders", BindingFlags.NonPublic | BindingFlags.Static);
var changesBuilders = (System.Collections.IDictionary)diff.GetValue(null);
- IEnumerable diffResults = typeof(Diff).Assembly.GetExportedTypes()
- .Where(type => type.GetInterface("IDiffResult") != null);
+ IEnumerable diffResults = typeof(Diff).GetTypeInfo().Assembly.GetExportedTypes()
+ .Where(type => type.GetTypeInfo().GetInterface("IDiffResult") != null);
var nonBuilderTypes = diffResults.Where(diffResult => !changesBuilders.Contains(diffResult));
Assert.False(nonBuilderTypes.Any(), "Classes which implement IDiffResult but are not registered under ChangesBuilders in Diff:" + Environment.NewLine +
diff --git a/LibGit2Sharp.Tests/Properties/AssemblyInfo.cs b/LibGit2Sharp.Tests/Properties/AssemblyInfo.cs
index adf33cb34..a4bcec543 100644
--- a/LibGit2Sharp.Tests/Properties/AssemblyInfo.cs
+++ b/LibGit2Sharp.Tests/Properties/AssemblyInfo.cs
@@ -1,42 +1,3 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-using Xunit;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("libgit2sharp.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("libgit2sharp.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2010")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("808554a4-f9fd-4035-8ab9-325793c7da51")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+using Xunit;
[assembly: CollectionBehavior(DisableTestParallelization = true)]
diff --git a/LibGit2Sharp.Tests/RepositoryFixture.cs b/LibGit2Sharp.Tests/RepositoryFixture.cs
index ec2192875..4934629b9 100644
--- a/LibGit2Sharp.Tests/RepositoryFixture.cs
+++ b/LibGit2Sharp.Tests/RepositoryFixture.cs
@@ -167,6 +167,10 @@ private static void CheckGitConfigFile(string dir)
private static void AssertIsHidden(string repoPath)
{
+ //Workaround for .NET Core 1.x never considering a directory hidden if the path has a trailing slash
+ //https://github.com/dotnet/corefx/issues/18520
+ repoPath = repoPath.TrimEnd('/');
+
FileAttributes attribs = File.GetAttributes(repoPath);
Assert.Equal(FileAttributes.Hidden, (attribs & FileAttributes.Hidden));
diff --git a/LibGit2Sharp.Tests/SetErrorFixture.cs b/LibGit2Sharp.Tests/SetErrorFixture.cs
index b10a54108..31b7513a2 100644
--- a/LibGit2Sharp.Tests/SetErrorFixture.cs
+++ b/LibGit2Sharp.Tests/SetErrorFixture.cs
@@ -49,7 +49,11 @@ public void FormatAggregateException()
Exception exceptionToThrow = new AggregateException(aggregateExceptionMessage, new Exception(innerExceptionMessage), new Exception(innerExceptionMessage2));
StringBuilder sb = new StringBuilder();
+#if DESKTOP
sb.AppendLine(aggregateExceptionMessage);
+#else
+ sb.AppendLine($"{aggregateExceptionMessage} ({innerExceptionMessage}) ({innerExceptionMessage2})");
+#endif
sb.AppendLine();
AppendIndentedLine(sb, expectedAggregateExceptionsHeaderText, 0);
@@ -104,7 +108,7 @@ private string IndentString(int level)
return new string(' ', level * 4);
}
- #region ThrowingOdbBackend
+#region ThrowingOdbBackend
private class ThrowingOdbBackend : OdbBackend
{
@@ -176,7 +180,7 @@ public override int ForEach(ForEachCallback callback)
}
}
- #endregion
+#endregion
}
}
diff --git a/LibGit2Sharp.Tests/StatusFixture.cs b/LibGit2Sharp.Tests/StatusFixture.cs
index 1fb0f889a..c5a8e2425 100644
--- a/LibGit2Sharp.Tests/StatusFixture.cs
+++ b/LibGit2Sharp.Tests/StatusFixture.cs
@@ -435,12 +435,12 @@ public void RetrievingTheStatusOfTheRepositoryHonorsTheGitIgnoreDirectives()
[InlineData(false, FileStatus.DeletedFromWorkdir, FileStatus.NewInWorkdir)]
public void RetrievingTheStatusOfAFilePathHonorsTheIgnoreCaseConfigurationSetting(
bool shouldIgnoreCase,
- FileStatus expectedlowerCasedFileStatus,
- FileStatus expectedCamelCasedFileStatus
+ FileStatus expectedLowercaseFileStatus,
+ FileStatus expectedUppercaseFileStatus
)
{
- string lowerCasedPath;
- const string lowercasedFilename = "plop";
+ string lowercasePath;
+ const string lowercaseFileName = "plop";
string repoPath = InitNewRepository();
@@ -448,24 +448,28 @@ FileStatus expectedCamelCasedFileStatus
{
repo.Config.Set("core.ignorecase", shouldIgnoreCase);
- lowerCasedPath = Touch(repo.Info.WorkingDirectory, lowercasedFilename);
+ lowercasePath = Touch(repo.Info.WorkingDirectory, lowercaseFileName);
- Commands.Stage(repo, lowercasedFilename);
+ Commands.Stage(repo, lowercaseFileName);
repo.Commit("initial", Constants.Signature, Constants.Signature);
}
using (var repo = new Repository(repoPath))
{
- const string upercasedFilename = "Plop";
+ const string uppercaseFileName = "PLOP";
- string camelCasedPath = Path.Combine(repo.Info.WorkingDirectory, upercasedFilename);
- File.Move(lowerCasedPath, camelCasedPath);
+ string uppercasePath = Path.Combine(repo.Info.WorkingDirectory, uppercaseFileName);
- Assert.Equal(expectedlowerCasedFileStatus, repo.RetrieveStatus(lowercasedFilename));
- Assert.Equal(expectedCamelCasedFileStatus, repo.RetrieveStatus(upercasedFilename));
+ //Workaround for problem with .NET Core 1.x on macOS where going directly from lowercasePath to uppercasePath fails
+ //https://github.com/dotnet/corefx/issues/18521
+ File.Move(lowercasePath, "__tmp__");
+ File.Move("__tmp__", uppercasePath);
- AssertStatus(shouldIgnoreCase, expectedlowerCasedFileStatus, repo, camelCasedPath.ToLowerInvariant());
- AssertStatus(shouldIgnoreCase, expectedCamelCasedFileStatus, repo, camelCasedPath.ToUpperInvariant());
+ Assert.Equal(expectedLowercaseFileStatus, repo.RetrieveStatus(lowercaseFileName));
+ Assert.Equal(expectedUppercaseFileStatus, repo.RetrieveStatus(uppercaseFileName));
+
+ AssertStatus(shouldIgnoreCase, expectedLowercaseFileStatus, repo, uppercasePath.ToLowerInvariant());
+ AssertStatus(shouldIgnoreCase, expectedUppercaseFileStatus, repo, uppercasePath.ToUpperInvariant());
}
}
diff --git a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
index 44aafabb4..f1ac7eddd 100644
--- a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
+++ b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
@@ -59,9 +59,9 @@ private static void SetUpTestEnvironment()
{
IsFileSystemCaseSensitive = IsFileSystemCaseSensitiveInternal();
- string initialAssemblyParentFolder = Directory.GetParent(new Uri(typeof(BaseFixture).Assembly.EscapedCodeBase).LocalPath).FullName;
+ string initialAssemblyParentFolder = Directory.GetParent(new Uri(typeof(BaseFixture).GetTypeInfo().Assembly.CodeBase).LocalPath).FullName;
- const string sourceRelativePath = @"../../Resources";
+ const string sourceRelativePath = @"../../../../LibGit2Sharp.Tests/Resources";
ResourcesDirectory = new DirectoryInfo(Path.Combine(initialAssemblyParentFolder, sourceRelativePath));
// Setup standard paths to our test repositories
@@ -383,10 +383,19 @@ protected static string Touch(string parent, string file, string content = null,
string dir = Path.GetDirectoryName(filePath);
Debug.Assert(dir != null);
+ var newFile = !File.Exists(filePath);
+
Directory.CreateDirectory(dir);
File.WriteAllText(filePath, content ?? string.Empty, encoding ?? Encoding.ASCII);
+ //Workaround for .NET Core 1.x behavior where all newly created files have execute permissions set.
+ //https://github.com/dotnet/corefx/issues/13342
+ if (Constants.IsRunningOnUnix && newFile)
+ {
+ RemoveExecutePermissions(filePath, newFile);
+ }
+
return filePath;
}
@@ -398,6 +407,8 @@ protected static string Touch(string parent, string file, Stream stream)
string dir = Path.GetDirectoryName(filePath);
Debug.Assert(dir != null);
+ var newFile = !File.Exists(filePath);
+
Directory.CreateDirectory(dir);
using (var fs = File.Open(filePath, FileMode.Create))
@@ -406,9 +417,22 @@ protected static string Touch(string parent, string file, Stream stream)
fs.Flush();
}
+ //Work around .NET Core 1.x behavior where all newly created files have execute permissions set.
+ //https://github.com/dotnet/corefx/issues/13342
+ if (Constants.IsRunningOnUnix && newFile)
+ {
+ RemoveExecutePermissions(filePath, newFile);
+ }
+
return filePath;
}
+ private static void RemoveExecutePermissions(string filePath, bool newFile)
+ {
+ var process = Process.Start("chmod", $"644 {filePath}");
+ process.WaitForExit();
+ }
+
protected string Expected(string filename)
{
return File.ReadAllText(Path.Combine(ResourcesDirectory.FullName, "expected/" + filename));
diff --git a/LibGit2Sharp.Tests/TestHelpers/Constants.cs b/LibGit2Sharp.Tests/TestHelpers/Constants.cs
index 334b61dc1..b5cd96d7e 100644
--- a/LibGit2Sharp.Tests/TestHelpers/Constants.cs
+++ b/LibGit2Sharp.Tests/TestHelpers/Constants.cs
@@ -55,27 +55,25 @@ public static string BuildPath()
{
string tempPath = null;
- if (IsRunningOnUnix)
+ const string LibGit2TestPath = "LibGit2TestPath";
+
+ // We're running on .Net/Windows
+ if (Environment.GetEnvironmentVariables().Contains(LibGit2TestPath))
{
- // We're running on Mono/*nix. Let's unwrap the path
- tempPath = UnwrapUnixTempPath();
+ Trace.TraceInformation("{0} environment variable detected", LibGit2TestPath);
+ tempPath = Environment.GetEnvironmentVariables()[LibGit2TestPath] as String;
}
- else
+
+ if (String.IsNullOrWhiteSpace(tempPath) || !Directory.Exists(tempPath))
+ {
+ Trace.TraceInformation("Using default test path value");
+ tempPath = Path.GetTempPath();
+ }
+
+ //workaround macOS symlinking its temp folder
+ if (tempPath.StartsWith("/var"))
{
- const string LibGit2TestPath = "LibGit2TestPath";
-
- // We're running on .Net/Windows
- if (Environment.GetEnvironmentVariables().Contains(LibGit2TestPath))
- {
- Trace.TraceInformation("{0} environment variable detected", LibGit2TestPath);
- tempPath = Environment.GetEnvironmentVariables()[LibGit2TestPath] as String;
- }
-
- if (String.IsNullOrWhiteSpace(tempPath) || !Directory.Exists(tempPath))
- {
- Trace.TraceInformation("Using default test path value");
- tempPath = Path.GetTempPath();
- }
+ tempPath = "/private" + tempPath;
}
string testWorkingDirectory = Path.Combine(tempPath, "LibGit2Sharp-TestRepos");
@@ -83,16 +81,6 @@ public static string BuildPath()
return testWorkingDirectory;
}
- private static string UnwrapUnixTempPath()
- {
- var type = Type.GetType("Mono.Unix.UnixPath, Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
-
- return (string)type.InvokeMember("GetCompleteRealPath",
- BindingFlags.Static | BindingFlags.FlattenHierarchy |
- BindingFlags.InvokeMethod | BindingFlags.Public,
- null, type, new object[] { Path.GetTempPath() });
- }
-
// To help with creating secure strings to test with.
internal static SecureString StringToSecureString(string str)
{
diff --git a/LibGit2Sharp.Tests/TestHelpers/DirectoryHelper.cs b/LibGit2Sharp.Tests/TestHelpers/DirectoryHelper.cs
index 66c1d594a..636d4f198 100644
--- a/LibGit2Sharp.Tests/TestHelpers/DirectoryHelper.cs
+++ b/LibGit2Sharp.Tests/TestHelpers/DirectoryHelper.cs
@@ -3,6 +3,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Reflection;
using System.Threading;
namespace LibGit2Sharp.Tests.TestHelpers
@@ -78,7 +79,7 @@ private static void DeleteDirectory(string directoryPath, int maxAttempts, int i
{
var caughtExceptionType = ex.GetType();
- if (!whitelist.Any(knownExceptionType => knownExceptionType.IsAssignableFrom(caughtExceptionType)))
+ if (!whitelist.Any(knownExceptionType => knownExceptionType.GetTypeInfo().IsAssignableFrom(caughtExceptionType)))
{
throw;
}
diff --git a/LibGit2Sharp.Tests/VisualStudio.Tests.targets b/LibGit2Sharp.Tests/VisualStudio.Tests.targets
deleted file mode 100644
index 53e10341f..000000000
--- a/LibGit2Sharp.Tests/VisualStudio.Tests.targets
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/LibGit2Sharp.Tests/desktop/MetaFixture.cs b/LibGit2Sharp.Tests/desktop/MetaFixture.cs
new file mode 100644
index 000000000..5103e19c6
--- /dev/null
+++ b/LibGit2Sharp.Tests/desktop/MetaFixture.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Linq;
+using System.Reflection;
+using Xunit;
+
+namespace LibGit2Sharp.Tests
+{
+ public partial class MetaFixture
+ {
+ [Fact]
+ public void LibGit2SharpPublicInterfacesCoverAllPublicMembers()
+ {
+ var methodsMissingFromInterfaces =
+ from t in typeof(IRepository).GetTypeInfo().Assembly.GetExportedTypes()
+ where !t.GetTypeInfo().IsInterface
+ where t.GetTypeInfo().GetInterfaces().Any(i => i.GetTypeInfo().IsPublic && i.Namespace == typeof(IRepository).Namespace && !explicitOnlyInterfaces.Contains(i))
+ let interfaceTargetMethods = from i in t.GetTypeInfo().GetInterfaces()
+ from im in t.GetInterfaceMap(i).TargetMethods
+ select im
+ from tm in t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance)
+ where !interfaceTargetMethods.Contains(tm)
+ select t.Name + " has extra method " + tm.Name;
+
+ Assert.Equal("", string.Join(Environment.NewLine,
+ methodsMissingFromInterfaces.ToArray()));
+ }
+
+ [Fact]
+ public void LibGit2SharpExplicitOnlyInterfacesAreIndeedExplicitOnly()
+ {
+ var methodsMissingFromInterfaces =
+ from t in typeof(IRepository).GetTypeInfo().Assembly.GetExportedTypes()
+ where t.GetInterfaces().Any(explicitOnlyInterfaces.Contains)
+ let interfaceTargetMethods = from i in t.GetInterfaces()
+ where explicitOnlyInterfaces.Contains(i)
+ from im in t.GetTypeInfo().GetInterfaceMap(i).TargetMethods
+ select im
+ from tm in t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance)
+ where interfaceTargetMethods.Contains(tm)
+ select t.Name + " has public method " + tm.Name + " which should be explicitly implemented.";
+
+ Assert.Equal("", string.Join(Environment.NewLine,
+ methodsMissingFromInterfaces.ToArray()));
+ }
+ }
+}
diff --git a/LibGit2Sharp.Tests/ShadowCopyFixture.cs b/LibGit2Sharp.Tests/desktop/ShadowCopyFixture.cs
similarity index 100%
rename from LibGit2Sharp.Tests/ShadowCopyFixture.cs
rename to LibGit2Sharp.Tests/desktop/ShadowCopyFixture.cs
diff --git a/LibGit2Sharp.Tests/SmartSubtransportFixture.cs b/LibGit2Sharp.Tests/desktop/SmartSubtransportFixture.cs
similarity index 100%
rename from LibGit2Sharp.Tests/SmartSubtransportFixture.cs
rename to LibGit2Sharp.Tests/desktop/SmartSubtransportFixture.cs
diff --git a/LibGit2Sharp.Tests/packages.config b/LibGit2Sharp.Tests/packages.config
deleted file mode 100644
index 2748122d3..000000000
--- a/LibGit2Sharp.Tests/packages.config
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/LibGit2Sharp.sln b/LibGit2Sharp.sln
index 765e8dd01..64945776b 100644
--- a/LibGit2Sharp.sln
+++ b/LibGit2Sharp.sln
@@ -1,16 +1,24 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26407.1
+MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2Sharp", "LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2Sharp.Tests", "LibGit2Sharp.Tests\LibGit2Sharp.Tests.csproj", "{286E63EB-04DD-4ADE-88D6-041B57800761}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{19D079A4-A273-4630-B2D2-79EADE3E7CA1}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenerationAttributes", "CodeGenerationAttributes\CodeGenerationAttributes.csproj", "{E1A8B99F-B2F6-4A38-9DF6-8792056D70FF}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0CA739FD-DA4D-4F64-9834-DA14A3ECD04B}"
ProjectSection(SolutionItems) = preProject
- .nuget\packages.config = .nuget\packages.config
+ .gitignore = .gitignore
+ nuget.config = nuget.config
+ version.json = version.json
EndProjectSection
EndProject
Global
+ GlobalSection(SharedMSBuildProjectFiles) = preSolution
+ EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
@@ -24,33 +32,12 @@ Global
{286E63EB-04DD-4ADE-88D6-041B57800761}.Debug|Any CPU.Build.0 = Debug|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Release|Any CPU.ActiveCfg = Release|Any CPU
{286E63EB-04DD-4ADE-88D6-041B57800761}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E1A8B99F-B2F6-4A38-9DF6-8792056D70FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E1A8B99F-B2F6-4A38-9DF6-8792056D70FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E1A8B99F-B2F6-4A38-9DF6-8792056D70FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E1A8B99F-B2F6-4A38-9DF6-8792056D70FF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
- GlobalSection(MonoDevelopProperties) = preSolution
- Policies = $0
- $0.TextStylePolicy = $1
- $1.inheritsSet = null
- $1.scope = text/x-csharp
- $0.CSharpFormattingPolicy = $2
- $2.IndentSwitchBody = True
- $2.BeforeMethodCallParentheses = False
- $2.BeforeMethodDeclarationParentheses = False
- $2.BeforeConstructorDeclarationParentheses = False
- $2.BeforeDelegateDeclarationParentheses = False
- $2.NewParentheses = False
- $2.inheritsSet = Mono
- $2.inheritsScope = text/x-csharp
- $2.scope = text/x-csharp
- $0.StandardHeader = $3
- $3.Text =
- $3.inheritsSet = Apache2License
- $0.TextStylePolicy = $4
- $4.FileWidth = 120
- $4.RemoveTrailingWhitespace = True
- $4.inheritsSet = VisualStudio
- $4.inheritsScope = text/plain
- $4.scope = text/plain
- EndGlobalSection
EndGlobal
diff --git a/LibGit2Sharp/AmbiguousSpecificationException.cs b/LibGit2Sharp/AmbiguousSpecificationException.cs
index bad7af141..0eece24ee 100644
--- a/LibGit2Sharp/AmbiguousSpecificationException.cs
+++ b/LibGit2Sharp/AmbiguousSpecificationException.cs
@@ -1,13 +1,17 @@
using System;
using System.Globalization;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
namespace LibGit2Sharp
{
///
/// The exception that is thrown when the provided specification cannot uniquely identify a reference, an object or a path.
///
+#if DESKTOP
[Serializable]
+#endif
public class AmbiguousSpecificationException : LibGit2SharpException
{
///
@@ -43,6 +47,7 @@ public AmbiguousSpecificationException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -51,5 +56,6 @@ public AmbiguousSpecificationException(string message, Exception innerException)
protected AmbiguousSpecificationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
}
}
diff --git a/LibGit2Sharp/BareRepositoryException.cs b/LibGit2Sharp/BareRepositoryException.cs
index 75ad9695c..7954867f7 100644
--- a/LibGit2Sharp/BareRepositoryException.cs
+++ b/LibGit2Sharp/BareRepositoryException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -8,7 +10,9 @@ namespace LibGit2Sharp
/// The exception that is thrown when an operation which requires a
/// working directory is performed against a bare repository.
///
+#if DESKTOP
[Serializable]
+#endif
public class BareRepositoryException : LibGit2SharpException
{
///
@@ -43,6 +47,7 @@ public BareRepositoryException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -51,6 +56,7 @@ public BareRepositoryException(string message, Exception innerException)
protected BareRepositoryException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal BareRepositoryException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/BufferedStream.cs b/LibGit2Sharp/BufferedStream.cs
new file mode 100644
index 000000000..6b6a58052
--- /dev/null
+++ b/LibGit2Sharp/BufferedStream.cs
@@ -0,0 +1,96 @@
+#if NETSTANDARD1_3
+
+namespace LibGit2Sharp
+{
+ using Core;
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Linq;
+ using System.Text;
+ using System.Threading.Tasks;
+
+ ///
+ /// A cheap substitute for the .NET BufferedStream class that isn't available on portable profiles.
+ ///
+ internal class BufferedStream : Stream
+ {
+ private int bufferSize;
+ private Stream targetStream;
+ private MemoryStream bufferStream;
+
+ public BufferedStream(Stream targetStream, int bufferSize)
+ {
+ Ensure.ArgumentNotNull(targetStream, nameof(targetStream));
+
+ this.targetStream = targetStream;
+ this.bufferSize = bufferSize;
+ this.bufferStream = new MemoryStream(bufferSize);
+ }
+
+ public override bool CanRead => false; // this implementation only supports writing.
+
+ public override bool CanSeek => false;
+
+ public override bool CanWrite => this.targetStream.CanWrite;
+
+ public override long Length
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ public override long Position
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ public override void Flush()
+ {
+ if (this.bufferStream.Length > 0)
+ {
+ this.bufferStream.Position = 0;
+ this.bufferStream.CopyTo(this.targetStream, this.bufferSize);
+ this.bufferStream.Position = 0;
+ this.bufferStream.SetLength(0);
+ }
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ throw new NotSupportedException();
+ }
+
+ public override void SetLength(long value)
+ {
+ throw new NotSupportedException();
+ }
+
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ this.bufferStream.Write(buffer, offset, count);
+ if (this.bufferStream.Length > this.bufferSize)
+ {
+ this.Flush();
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ this.Flush();
+ this.targetStream.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+ }
+}
+
+#endif
diff --git a/LibGit2Sharp/CertificateX509.cs b/LibGit2Sharp/CertificateX509.cs
index b48d3fc55..8de124b8f 100644
--- a/LibGit2Sharp/CertificateX509.cs
+++ b/LibGit2Sharp/CertificateX509.cs
@@ -39,7 +39,7 @@ internal unsafe IntPtr ToPointers(out IntPtr dataPtr)
{
cert_type = GitCertificateType.X509,
data = (byte*) dataPtr.ToPointer(),
- len = (UIntPtr)certData.LongLength,
+ len = (UIntPtr)certData.Length,
};
var ptr = Marshal.AllocHGlobal(Marshal.SizeOf(gitCert));
diff --git a/LibGit2Sharp/CheckoutConflictException.cs b/LibGit2Sharp/CheckoutConflictException.cs
index a06360afb..8480ccf60 100644
--- a/LibGit2Sharp/CheckoutConflictException.cs
+++ b/LibGit2Sharp/CheckoutConflictException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -9,7 +11,9 @@ namespace LibGit2Sharp
/// because of a conflicting change staged in the index, or unstaged
/// in the working directory.
///
+#if DESKTOP
[Serializable]
+#endif
public class CheckoutConflictException : LibGit2SharpException
{
///
@@ -44,6 +48,7 @@ public CheckoutConflictException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -56,5 +61,6 @@ protected CheckoutConflictException(SerializationInfo info, StreamingContext con
internal CheckoutConflictException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
{ }
+#endif
}
}
diff --git a/LibGit2Sharp/CodeGenerator.targets b/LibGit2Sharp/CodeGenerator.targets
new file mode 100644
index 000000000..402001459
--- /dev/null
+++ b/LibGit2Sharp/CodeGenerator.targets
@@ -0,0 +1,89 @@
+
+
+
+ $(MSBuildProjectDirectory)\..\lkg\
+
+
+
+
+ false
+
+
+
+
+
+
+ $(CoreCompileDependsOn);GenerateNativeDllNameCs
+ GenerateCommitIdVersion;$(PrepareResourceNamesDependsOn)
+ $(IntermediateOutputPath)NativeDllName.cs
+ $(IntermediateOutputPath)UniqueIdentifier.cs
+ $(IntermediateOutputPath)libgit2sharp_hash.txt
+
+
+
+
+
+
+
+
+
+namespace LibGit2Sharp.Core
+{
+ internal static class NativeDllName
+ {
+ public const string Name = "$(libgit2FileName)"%3b
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $(RootNamespace).libgit2sharp_hash.txt
+
+
+
+
diff --git a/LibGit2Sharp/Core/EncodingMarshaler.cs b/LibGit2Sharp/Core/EncodingMarshaler.cs
index 0cafd9aa1..af10db780 100644
--- a/LibGit2Sharp/Core/EncodingMarshaler.cs
+++ b/LibGit2Sharp/Core/EncodingMarshaler.cs
@@ -117,7 +117,11 @@ public static unsafe string FromNative(Encoding encoding, byte* pNativeData)
return String.Empty;
}
+#if DESKTOP
return new String((sbyte*)pNativeData, 0, (int)(walk - start), encoding);
+#else
+ return encoding.GetString(pNativeData, (int)(walk - start));
+#endif
}
public static unsafe string FromNative(Encoding encoding, IntPtr pNativeData, int length)
@@ -132,7 +136,11 @@ public static unsafe string FromNative(Encoding encoding, IntPtr pNativeData, in
return String.Empty;
}
+#if DESKTOP
return new String((sbyte*)pNativeData.ToPointer(), 0, length, encoding);
+#else
+ return encoding.GetString((byte*)pNativeData.ToPointer(), length);
+#endif
}
public static string FromBuffer(Encoding encoding, byte[] buffer)
diff --git a/LibGit2Sharp/Core/FilePathMarshaler.cs b/LibGit2Sharp/Core/FilePathMarshaler.cs
index 9d238a46d..952c6de18 100644
--- a/LibGit2Sharp/Core/FilePathMarshaler.cs
+++ b/LibGit2Sharp/Core/FilePathMarshaler.cs
@@ -10,15 +10,13 @@ namespace LibGit2Sharp.Core
/// free the native pointer after conversion, because the memory is owned by libgit2.
///
/// Use this marshaler for return values, for example:
- /// [return: MarshalAs(UnmanagedType.CustomMarshaler,
- /// MarshalCookie = UniqueId.UniqueIdentifier,
- /// MarshalTypeRef = typeof(LaxFilePathNoCleanupMarshaler))]
+ /// [return: CustomMarshaler(typeof(LaxFilePathNoCleanupMarshaler), typeof(FilePath))]
///
internal class LaxFilePathNoCleanupMarshaler : LaxFilePathMarshaler
{
private static readonly LaxFilePathNoCleanupMarshaler staticInstance = new LaxFilePathNoCleanupMarshaler();
- public new static ICustomMarshaler GetInstance(String cookie)
+ public new static ICustomMarshaler GetInstance()
{
return staticInstance;
}
@@ -41,16 +39,15 @@ public override void CleanUpNativeData(IntPtr pNativeData)
///
/// Use this marshaler for function parameters, for example:
/// [DllImport(libgit2)]
- /// internal static extern int git_index_open(out IndexSafeHandle index,
- /// [MarshalAs(UnmanagedType.CustomMarshaler,
- /// MarshalCookie = UniqueId.UniqueIdentifier,
- /// MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath indexpath);
+ /// private static extern unsafe int git_index_remove_bypath(
+ /// git_index* index,
+ /// [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path);
///
internal class StrictFilePathMarshaler : StrictUtf8Marshaler
{
private static readonly StrictFilePathMarshaler staticInstance = new StrictFilePathMarshaler();
- public new static ICustomMarshaler GetInstance(String cookie)
+ public new static ICustomMarshaler GetInstance()
{
return staticInstance;
}
@@ -70,7 +67,7 @@ public override IntPtr MarshalManagedToNative(Object managedObj)
{
throw new MarshalDirectiveException(string.Format(CultureInfo.InvariantCulture,
"{0} must be used on a FilePath.",
- GetType().Name));
+ this.GetType().Name));
}
return FromManaged(filePath);
@@ -98,7 +95,7 @@ internal class LaxFilePathMarshaler : LaxUtf8Marshaler
{
private static readonly LaxFilePathMarshaler staticInstance = new LaxFilePathMarshaler();
- public new static ICustomMarshaler GetInstance(String cookie)
+ public new static ICustomMarshaler GetInstance()
{
return staticInstance;
}
diff --git a/LibGit2Sharp/Core/GitOdbBackend.cs b/LibGit2Sharp/Core/GitOdbBackend.cs
index f5335655e..ce2d1119b 100644
--- a/LibGit2Sharp/Core/GitOdbBackend.cs
+++ b/LibGit2Sharp/Core/GitOdbBackend.cs
@@ -8,7 +8,7 @@ internal struct GitOdbBackend
{
static GitOdbBackend()
{
- GCHandleOffset = Marshal.OffsetOf(typeof(GitOdbBackend), "GCHandle").ToInt32();
+ GCHandleOffset = Marshal.OffsetOf(typeof(GitOdbBackend), nameof(GCHandle)).ToInt32();
}
public uint Version;
diff --git a/LibGit2Sharp/Core/GitOdbBackendStream.cs b/LibGit2Sharp/Core/GitOdbBackendStream.cs
index 30477ecbd..1bd6439ba 100644
--- a/LibGit2Sharp/Core/GitOdbBackendStream.cs
+++ b/LibGit2Sharp/Core/GitOdbBackendStream.cs
@@ -15,7 +15,7 @@ internal class GitOdbBackendStream
{
static GitOdbBackendStream()
{
- GCHandleOffset = Marshal.OffsetOf(typeof(GitOdbBackendStream), "GCHandle").ToInt32();
+ GCHandleOffset = Marshal.OffsetOf(typeof(GitOdbBackendStream), nameof(GCHandle)).ToInt32();
}
public IntPtr Backend;
diff --git a/LibGit2Sharp/Core/GitSmartSubtransport.cs b/LibGit2Sharp/Core/GitSmartSubtransport.cs
index d9b3c7545..73345e511 100644
--- a/LibGit2Sharp/Core/GitSmartSubtransport.cs
+++ b/LibGit2Sharp/Core/GitSmartSubtransport.cs
@@ -8,7 +8,7 @@ internal class GitSmartSubtransport
{
static GitSmartSubtransport()
{
- GCHandleOffset = Marshal.OffsetOf(typeof(GitSmartSubtransport), "GCHandle").ToInt32();
+ GCHandleOffset = Marshal.OffsetOf(typeof(GitSmartSubtransport), nameof(GCHandle)).ToInt32();
}
public action_callback Action;
diff --git a/LibGit2Sharp/Core/GitSmartSubtransportStream.cs b/LibGit2Sharp/Core/GitSmartSubtransportStream.cs
index 16155aeba..22dc6564f 100644
--- a/LibGit2Sharp/Core/GitSmartSubtransportStream.cs
+++ b/LibGit2Sharp/Core/GitSmartSubtransportStream.cs
@@ -8,7 +8,7 @@ internal class GitSmartSubtransportStream
{
static GitSmartSubtransportStream()
{
- GCHandleOffset = Marshal.OffsetOf(typeof(GitSmartSubtransportStream), "GCHandle").ToInt32();
+ GCHandleOffset = Marshal.OffsetOf(typeof(GitSmartSubtransportStream), nameof(GCHandle)).ToInt32();
}
public IntPtr SmartTransport;
diff --git a/LibGit2Sharp/Core/Handles/Libgit2Object.cs b/LibGit2Sharp/Core/Handles/Libgit2Object.cs
index cbb431a98..5d5dc5459 100644
--- a/LibGit2Sharp/Core/Handles/Libgit2Object.cs
+++ b/LibGit2Sharp/Core/Handles/Libgit2Object.cs
@@ -1,7 +1,7 @@
// This activates a lightweight mode which will help put under the light
// incorrectly released handles by outputing a warning message in the console.
//
-// This should be activated when tests are being run of the CI server.
+// This should be activated when tests are being run on the CI server.
//
// Uncomment the line below or add a conditional symbol to activate this mode
@@ -106,7 +106,18 @@ internal unsafe Libgit2Object(void* handle, bool owned)
#if LEAKS_TRACKING
id = Guid.NewGuid();
Trace.WriteLine(string.Format(CultureInfo.InvariantCulture, "Allocating {0} handle ({1})", GetType().Name, id));
+#if DESKTOP
trace = new StackTrace(2, true).ToString();
+#else
+ try
+ {
+ throw new Exception();
+ }
+ catch (Exception ex)
+ {
+ trace = new StackTrace(ex, true).ToString();
+ }
+#endif
#endif
}
diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs
index c69bc1f8b..f2ea4f68a 100644
--- a/LibGit2Sharp/Core/NativeMethods.cs
+++ b/LibGit2Sharp/Core/NativeMethods.cs
@@ -2,7 +2,9 @@
using System.Globalization;
using System.IO;
using System.Runtime.CompilerServices;
+#if DESKTOP
using System.Runtime.ConstrainedExecution;
+#endif
using System.Runtime.InteropServices;
using System.Threading;
using LibGit2Sharp.Core.Handles;
@@ -10,14 +12,15 @@
// ReSharper disable InconsistentNaming
namespace LibGit2Sharp.Core
{
- internal static class NativeMethods
+ [OfferFriendlyInteropOverloads]
+ internal static partial class NativeMethods
{
public const uint GIT_PATH_MAX = 4096;
private const string libgit2 = NativeDllName.Name;
// This is here to keep the pointer alive
- #pragma warning disable 0414
+#pragma warning disable 0414
private static readonly LibraryLifetimeObject lifetimeObject;
- #pragma warning restore 0414
+#pragma warning restore 0414
private static int handlesCount;
///
@@ -25,7 +28,10 @@ internal static class NativeMethods
/// have run to completion ensuring that no dangling git-related finalizer runs after git_threads_shutdown.
/// There should never be more than one instance of this object per AppDomain.
///
- private sealed class LibraryLifetimeObject : CriticalFinalizerObject
+ private sealed class LibraryLifetimeObject
+#if DESKTOP
+ : CriticalFinalizerObject
+#endif
{
// Ensure mono can JIT the .cctor and adjust the PATH before trying to load the native library.
// See https://github.com/libgit2/libgit2sharp/pull/190
@@ -48,13 +54,17 @@ public LibraryLifetimeObject()
}
}
+#if DESKTOP
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+#endif
internal static void AddHandle()
{
Interlocked.Increment(ref handlesCount);
}
+#if DESKTOP
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+#endif
internal static void RemoveHandle()
{
int count = Interlocked.Decrement(ref handlesCount);
@@ -85,9 +95,9 @@ static NativeMethods()
internal static extern unsafe GitError* giterr_last();
[DllImport(libgit2)]
- internal static extern void giterr_set_str(
+ private static unsafe extern void giterr_set_str(
GitErrorCategory error_class,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string errorString);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* errorString);
[DllImport(libgit2)]
internal static extern void giterr_set_oom();
@@ -100,32 +110,32 @@ internal static extern void giterr_set_str(
git_blame* blame, UInt32 index);
[DllImport(libgit2)]
- internal static extern unsafe int git_blame_file(
+ private static extern unsafe int git_blame_file(
out git_blame* blame,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path,
git_blame_options options);
[DllImport(libgit2)]
internal static extern unsafe void git_blame_free(git_blame* blame);
[DllImport(libgit2)]
- internal static extern unsafe int git_blob_create_fromdisk(
+ private static extern unsafe int git_blob_create_fromdisk(
ref GitOid id,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path);
[DllImport(libgit2)]
- internal static extern unsafe int git_blob_create_fromworkdir(
+ private static extern unsafe int git_blob_create_fromworkdir(
ref GitOid id,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath relative_path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* relative_path);
[DllImport(libgit2)]
- internal static extern unsafe int git_blob_create_fromstream(
+ private static extern unsafe int git_blob_create_fromstream(
out IntPtr stream,
git_repository* repositoryPtr,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath hintpath);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* hintpath);
[DllImport(libgit2)]
internal static extern unsafe int git_blob_create_fromstream_commit(
@@ -133,10 +143,10 @@ internal static extern unsafe int git_blob_create_fromstream_commit(
IntPtr stream);
[DllImport(libgit2)]
- internal static extern unsafe int git_blob_filtered_content(
+ private static extern unsafe int git_blob_filtered_content(
GitBuf buf,
git_object* blob,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath as_path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* as_path,
[MarshalAs(UnmanagedType.Bool)] bool check_for_binary_data);
[DllImport(libgit2)]
@@ -146,10 +156,10 @@ internal static extern unsafe int git_blob_filtered_content(
internal static extern unsafe Int64 git_blob_rawsize(git_object* blob);
[DllImport(libgit2)]
- internal static extern unsafe int git_branch_create_from_annotated(
+ private static extern unsafe int git_branch_create_from_annotated(
out git_reference* ref_out,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string branch_name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* branch_name,
git_annotated_commit* target,
[MarshalAs(UnmanagedType.Bool)] bool force);
@@ -167,16 +177,16 @@ internal static extern void git_branch_iterator_free(
IntPtr iterator);
[DllImport(libgit2)]
- internal static extern int git_branch_iterator_new(
+ internal static extern int git_branch_iterator_new(
out IntPtr iter_out,
IntPtr repo,
GitBranchType branch_type);
[DllImport(libgit2)]
- internal static extern unsafe int git_branch_move(
+ private static extern unsafe int git_branch_move(
out git_reference* ref_out,
git_reference* reference,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_branch_name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* new_branch_name,
[MarshalAs(UnmanagedType.Bool)] bool force);
[DllImport(libgit2)]
@@ -186,10 +196,10 @@ internal static extern int git_branch_next(
IntPtr iter);
[DllImport(libgit2)]
- internal static extern unsafe int git_branch_remote_name(
+ private static extern unsafe int git_branch_remote_name(
GitBuf buf,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string canonical_branch_name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* canonical_branch_name);
[DllImport(libgit2)]
internal static extern unsafe int git_rebase_init(
@@ -246,21 +256,21 @@ internal static extern unsafe int git_rebase_finish(
internal static extern unsafe void git_rebase_free(git_rebase* rebase);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_rename(
+ private static extern unsafe int git_remote_rename(
ref GitStrArray problems,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string old_name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* old_name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* new_name);
- internal delegate int git_remote_rename_problem_cb(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] string problematic_refspec,
+ private unsafe delegate int git_remote_rename_problem_cb(
+ [CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] byte* problematic_refspec,
IntPtr payload);
[DllImport(libgit2)]
- internal static extern unsafe int git_branch_upstream_name(
+ private static extern unsafe int git_branch_upstream_name(
GitBuf buf,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string referenceName);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* referenceName);
[DllImport(libgit2)]
internal static extern void git_buf_free(GitBuf buf);
@@ -278,10 +288,10 @@ internal static extern unsafe int git_checkout_index(
ref GitCheckoutOpts opts);
[DllImport(libgit2)]
- internal static extern unsafe int git_clone(
+ private static extern unsafe int git_clone(
out git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string origin_url,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath workdir_path,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* origin_url,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* workdir_path,
ref GitCloneOptions opts);
[DllImport(libgit2)]
@@ -291,50 +301,49 @@ internal static extern unsafe int git_clone(
internal static extern unsafe git_signature* git_commit_committer(git_object* commit);
[DllImport(libgit2)]
- internal static extern unsafe int git_commit_create_from_ids(
+ private static extern unsafe int git_commit_create_from_ids(
out GitOid id,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string updateRef,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* updateRef,
git_signature* author,
git_signature* committer,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string encoding,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* encoding,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message,
ref GitOid tree,
UIntPtr parentCount,
[MarshalAs(UnmanagedType.LPArray)] [In] IntPtr[] parents);
[DllImport(libgit2)]
- internal static extern unsafe int git_commit_create_buffer(
+ private static extern unsafe int git_commit_create_buffer(
GitBuf res,
git_repository* repo,
git_signature* author,
git_signature* committer,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string encoding,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* encoding,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message,
git_object* tree,
UIntPtr parent_count,
IntPtr* parents /* git_commit** originally */);
[DllImport(libgit2)]
- internal static extern unsafe int git_commit_create_with_signature(
+ private static extern unsafe int git_commit_create_with_signature(
out GitOid id,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string commit_content,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string signature,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string signature_field);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* commit_content,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* signature,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* signature_field);
+ [DllImport(libgit2, EntryPoint = "git_commit_message")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_commit_message_(git_object* commit);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_commit_message(git_object* commit);
-
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_commit_summary(git_object* commit);
+ [DllImport(libgit2, EntryPoint = "git_commit_summary")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_commit_summary_(git_object* commit);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_commit_message_encoding(git_object* commit);
+ [DllImport(libgit2, EntryPoint = "git_commit_message_encoding")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_commit_message_encoding_(git_object* commit);
[DllImport(libgit2)]
internal static extern unsafe git_oid* git_commit_parent_id(git_object* commit, uint n);
@@ -346,26 +355,26 @@ internal static extern unsafe int git_commit_create_with_signature(
internal static extern unsafe git_oid* git_commit_tree_id(git_object* commit);
[DllImport(libgit2)]
- internal static extern unsafe int git_commit_extract_signature(
+ private static extern unsafe int git_commit_extract_signature(
GitBuf signature,
GitBuf signed_data,
- git_repository *repo,
+ git_repository* repo,
ref GitOid commit_id,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string field);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* field);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_delete_entry(
+ private static extern unsafe int git_config_delete_entry(
git_config* cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
internal static extern unsafe int git_config_lock(out IntPtr txn, git_config* config);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_delete_multivar(
+ private static extern unsafe int git_config_delete_multivar(
git_config* cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string regexp);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* regexp);
[DllImport(libgit2)]
internal static extern int git_config_find_global(GitBuf global_config_path);
@@ -380,21 +389,21 @@ internal static extern unsafe int git_config_delete_multivar(
internal static extern int git_config_find_programdata(GitBuf programdata_config_path);
[DllImport(libgit2)]
- internal static extern unsafe void git_config_free(git_config *cfg);
+ internal static extern unsafe void git_config_free(git_config* cfg);
[DllImport(libgit2)]
internal static extern unsafe void git_config_entry_free(GitConfigEntry* entry);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_get_entry(
+ private static extern unsafe int git_config_get_entry(
out GitConfigEntry* entry,
git_config* cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_add_file_ondisk(
+ private static extern unsafe int git_config_add_file_ondisk(
git_config* cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path,
uint level,
[MarshalAs(UnmanagedType.Bool)] bool force);
@@ -408,43 +417,43 @@ internal static extern unsafe int git_config_open_level(
uint level);
[DllImport(libgit2)]
- internal static extern int git_config_parse_bool(
+ private static unsafe extern int git_config_parse_bool(
[MarshalAs(UnmanagedType.Bool)] out bool value,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string valueToParse);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* valueToParse);
[DllImport(libgit2)]
- internal static extern int git_config_parse_int32(
+ private static unsafe extern int git_config_parse_int32(
[MarshalAs(UnmanagedType.I4)] out int value,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string valueToParse);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* valueToParse);
[DllImport(libgit2)]
- internal static extern int git_config_parse_int64(
+ private static unsafe extern int git_config_parse_int64(
[MarshalAs(UnmanagedType.I8)] out long value,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string valueToParse);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* valueToParse);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_set_bool(
+ private static extern unsafe int git_config_set_bool(
git_config* cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
[MarshalAs(UnmanagedType.Bool)] bool value);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_set_int32(
+ private static extern unsafe int git_config_set_int32(
git_config* cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
int value);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_set_int64(
+ private static extern unsafe int git_config_set_int64(
git_config* cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
long value);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_set_string(
+ private static extern unsafe int git_config_set_string(
git_config* cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string value);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* value);
internal delegate int config_foreach_callback(
IntPtr entry,
@@ -457,10 +466,10 @@ internal static extern unsafe int git_config_foreach(
IntPtr payload);
[DllImport(libgit2)]
- internal static extern unsafe int git_config_iterator_glob_new(
+ private static extern unsafe int git_config_iterator_glob_new(
out IntPtr iter,
IntPtr cfg,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string regexp);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* regexp);
[DllImport(libgit2)]
internal static extern int git_config_next(
@@ -489,14 +498,14 @@ internal delegate int git_cred_acquire_cb(
internal static extern int git_cred_default_new(out IntPtr cred);
[DllImport(libgit2)]
- internal static extern int git_cred_userpass_plaintext_new(
+ private static unsafe extern int git_cred_userpass_plaintext_new(
out IntPtr cred,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string username,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string password);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* username,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* password);
[DllImport(libgit2)]
internal static extern void git_cred_free(IntPtr cred);
-
+
[DllImport(libgit2)]
internal static extern unsafe int git_describe_commit(
out git_describe_result* describe,
@@ -572,11 +581,11 @@ internal unsafe delegate int git_diff_binary_cb(
IntPtr payload);
[DllImport(libgit2)]
- internal static extern unsafe int git_diff_blobs(
+ private static extern unsafe int git_diff_blobs(
git_object* oldBlob,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath old_as_path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* old_as_path,
git_object* newBlob,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath new_as_path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* new_as_path,
GitDiffOptions options,
git_diff_file_cb fileCallback,
git_diff_binary_cb binaryCallback,
@@ -605,13 +614,13 @@ internal static extern unsafe int git_diff_find_similar(
internal static extern unsafe git_diff_delta* git_diff_get_delta(git_diff* diff, UIntPtr idx);
[DllImport(libgit2)]
- internal static extern int git_filter_register(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ private static unsafe extern int git_filter_register(
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
IntPtr gitFilter, int priority);
[DllImport(libgit2)]
- internal static extern int git_filter_unregister(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))]string name);
+ private static extern unsafe int git_filter_unregister(
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
internal static extern unsafe int git_filter_source_mode(git_filter_source* source);
@@ -633,8 +642,8 @@ internal static extern int git_filter_unregister(
// git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, int level, const char *path)
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
- internal static extern int git_libgit2_opts(int option, uint level,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))]string path);
+ private static unsafe extern int git_libgit2_opts(int option, uint level,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* path);
// git_libgit2_opts(GIT_OPT_ENABLE_*, int enabled)
[DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)]
@@ -651,23 +660,23 @@ internal static extern unsafe int git_graph_descendant_of(
ref GitOid ancestor);
[DllImport(libgit2)]
- internal static extern unsafe int git_ignore_add_rule(
+ private static extern unsafe int git_ignore_add_rule(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string rules);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* rules);
[DllImport(libgit2)]
internal static extern unsafe int git_ignore_clear_internal_rules(git_repository* repo);
[DllImport(libgit2)]
- internal static extern unsafe int git_ignore_path_is_ignored(
+ private static extern unsafe int git_ignore_path_is_ignored(
out int ignored,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path);
[DllImport(libgit2)]
- internal static extern unsafe int git_index_add_bypath(
+ private static extern unsafe int git_index_add_bypath(
git_index* index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path);
[DllImport(libgit2)]
internal static extern unsafe int git_index_add(
@@ -675,12 +684,12 @@ internal static extern unsafe int git_index_add(
git_index_entry* entry);
[DllImport(libgit2)]
- internal static extern unsafe int git_index_conflict_get(
+ private static extern unsafe int git_index_conflict_get(
out git_index_entry* ancestor,
out git_index_entry* ours,
out git_index_entry* theirs,
git_index* index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path);
[DllImport(libgit2)]
internal static extern unsafe int git_index_conflict_iterator_new(
@@ -711,9 +720,9 @@ internal static extern unsafe void git_index_conflict_iterator_free(
internal static extern unsafe git_index_entry* git_index_get_byindex(git_index* index, UIntPtr n);
[DllImport(libgit2)]
- internal static extern unsafe git_index_entry* git_index_get_bypath(
+ private static extern unsafe git_index_entry* git_index_get_bypath(
git_index* index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path,
int stage);
[DllImport(libgit2)]
@@ -726,9 +735,9 @@ internal static extern unsafe void git_index_conflict_iterator_free(
internal static extern unsafe git_index_name_entry* git_index_name_get_byindex(git_index* handle, UIntPtr n);
[DllImport(libgit2)]
- internal static extern unsafe int git_index_open(
+ private static extern unsafe int git_index_open(
out git_index* index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath indexpath);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* indexpath);
[DllImport(libgit2)]
internal static extern unsafe int git_index_read(
@@ -736,9 +745,9 @@ internal static extern unsafe int git_index_read(
[MarshalAs(UnmanagedType.Bool)] bool force);
[DllImport(libgit2)]
- internal static extern unsafe int git_index_remove_bypath(
+ private static extern unsafe int git_index_remove_bypath(
git_index* index,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path);
[DllImport(libgit2)]
@@ -748,9 +757,9 @@ internal static extern unsafe int git_index_remove_bypath(
internal static extern unsafe git_index_reuc_entry* git_index_reuc_get_byindex(git_index* handle, UIntPtr n);
[DllImport(libgit2)]
- internal static extern unsafe git_index_reuc_entry* git_index_reuc_get_bypath(
+ private static extern unsafe git_index_reuc_entry* git_index_reuc_get_bypath(
git_index* handle,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path);
[DllImport(libgit2)]
internal static extern unsafe int git_index_write(git_index* index);
@@ -788,18 +797,18 @@ internal static extern unsafe int git_annotated_commit_from_ref(
git_reference* reference);
[DllImport(libgit2)]
- internal static extern unsafe int git_annotated_commit_from_fetchhead(
+ private static extern unsafe int git_annotated_commit_from_fetchhead(
out git_annotated_commit* annotatedCommit,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string branch_name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote_url,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* branch_name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote_url,
ref GitOid oid);
[DllImport(libgit2)]
- internal static extern unsafe int git_annotated_commit_from_revspec(
+ private static extern unsafe int git_annotated_commit_from_revspec(
out git_annotated_commit* annotatedCommit,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string revspec);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* revspec);
[DllImport(libgit2)]
internal static extern unsafe int git_annotated_commit_lookup(
@@ -839,44 +848,44 @@ internal static extern unsafe int git_merge_analysis(
internal static extern unsafe void git_annotated_commit_free(git_annotated_commit* commit);
[DllImport(libgit2)]
- internal static extern int git_message_prettify(
+ private static unsafe extern int git_message_prettify(
GitBuf buf,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message,
[MarshalAs(UnmanagedType.Bool)] bool strip_comments,
sbyte comment_char);
[DllImport(libgit2)]
- internal static extern unsafe int git_note_create(
+ private static extern unsafe int git_note_create(
out GitOid noteOid,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string notes_ref,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* notes_ref,
git_signature* author,
git_signature* committer,
ref GitOid oid,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string note,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* note,
int force);
[DllImport(libgit2)]
internal static extern unsafe void git_note_free(git_note* note);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_note_message(git_note* note);
+ [DllImport(libgit2, EntryPoint = "git_note_message")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_note_message_(git_note* note);
[DllImport(libgit2)]
internal static extern unsafe git_oid* git_note_id(git_note* note);
[DllImport(libgit2)]
- internal static extern unsafe int git_note_read(
+ private static extern unsafe int git_note_read(
out git_note* note,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string notes_ref,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* notes_ref,
ref GitOid oid);
[DllImport(libgit2)]
- internal static extern unsafe int git_note_remove(
+ private static extern unsafe int git_note_remove(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string notes_ref,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* notes_ref,
git_signature* author,
git_signature* committer,
ref GitOid oid);
@@ -892,9 +901,9 @@ internal delegate int git_note_foreach_cb(
IntPtr payload);
[DllImport(libgit2)]
- internal static extern unsafe int git_note_foreach(
+ private static extern unsafe int git_note_foreach(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string notes_ref,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* notes_ref,
git_note_foreach_cb cb,
IntPtr payload);
@@ -939,7 +948,7 @@ internal static extern unsafe int git_odb_foreach(
internal static extern unsafe void git_odb_stream_free(git_odb_stream* stream);
[DllImport(libgit2)]
- internal static extern unsafe int git_odb_write(out GitOid id, git_odb *odb, byte* data, UIntPtr len, GitObjectType type);
+ internal static extern unsafe int git_odb_write(out GitOid id, git_odb* odb, byte* data, UIntPtr len, GitObjectType type);
[DllImport(libgit2)]
internal static extern unsafe git_oid* git_object_id(git_object* obj);
@@ -985,10 +994,10 @@ internal static extern unsafe int git_patch_line_stats(
internal static extern unsafe void git_packbuilder_free(git_packbuilder* packbuilder);
[DllImport(libgit2)]
- internal static extern unsafe int git_packbuilder_insert(
+ private static extern unsafe int git_packbuilder_insert(
git_packbuilder* packbuilder,
ref GitOid id,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
internal static extern unsafe int git_packbuilder_insert_commit(
@@ -996,10 +1005,10 @@ internal static extern unsafe int git_packbuilder_insert_commit(
ref GitOid id);
[DllImport(libgit2)]
- internal static extern unsafe int git_packbuilder_insert_recur(
+ private static extern unsafe int git_packbuilder_insert_recur(
git_packbuilder* packbuilder,
ref GitOid id,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
internal static extern unsafe int git_packbuilder_insert_tree(
@@ -1016,9 +1025,9 @@ internal static extern unsafe int git_packbuilder_insert_tree(
internal static extern unsafe UInt32 git_packbuilder_set_threads(git_packbuilder* packbuilder, UInt32 numThreads);
[DllImport(libgit2)]
- internal static extern unsafe int git_packbuilder_write(
+ private static extern unsafe int git_packbuilder_write(
git_packbuilder* packbuilder,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path,
uint mode,
IntPtr progressCallback,
IntPtr payload);
@@ -1027,31 +1036,31 @@ internal static extern unsafe int git_packbuilder_write(
internal static extern unsafe UIntPtr git_packbuilder_written(git_packbuilder* packbuilder);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_create(
+ private static extern unsafe int git_reference_create(
out git_reference* reference,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
ref GitOid oid,
[MarshalAs(UnmanagedType.Bool)] bool force,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_symbolic_create(
+ private static extern unsafe int git_reference_symbolic_create(
out git_reference* reference,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string target,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* target,
[MarshalAs(UnmanagedType.Bool)] bool force,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message);
internal delegate int ref_glob_callback(
IntPtr reference_name,
IntPtr payload);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_foreach_glob(
+ private static extern unsafe int git_reference_foreach_glob(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string glob,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* glob,
ref_glob_callback callback,
IntPtr payload);
@@ -1059,72 +1068,72 @@ internal static extern unsafe int git_reference_foreach_glob(
internal static extern unsafe void git_reference_free(git_reference* reference);
[DllImport(libgit2)]
- internal static extern int git_reference_is_valid_name(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string refname);
+ private static unsafe extern int git_reference_is_valid_name(
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* refname);
[DllImport(libgit2)]
internal static extern unsafe int git_reference_list(out GitStrArray array, git_repository* repo);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_lookup(
+ private static extern unsafe int git_reference_lookup(
out git_reference* reference,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_reference_name(git_reference* reference);
+ [DllImport(libgit2, EntryPoint = "git_reference_name")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_reference_name_(git_reference* reference);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_remove(
+ private static extern unsafe int git_reference_remove(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
internal static extern unsafe git_oid* git_reference_target(git_reference* reference);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_rename(
+ private static extern unsafe int git_reference_rename(
out git_reference* ref_out,
git_reference* reference,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string newName,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* newName,
[MarshalAs(UnmanagedType.Bool)] bool force,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_set_target(
+ private static extern unsafe int git_reference_set_target(
out git_reference* ref_out,
git_reference* reference,
ref GitOid id,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_symbolic_set_target(
+ private static extern unsafe int git_reference_symbolic_set_target(
out git_reference* ref_out,
git_reference* reference,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string target,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* target,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_reference_symbolic_target(git_reference* reference);
+ [DllImport(libgit2, EntryPoint = "git_reference_symbolic_target")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_reference_symbolic_target_(git_reference* reference);
[DllImport(libgit2)]
internal static extern unsafe GitReferenceType git_reference_type(git_reference* reference);
[DllImport(libgit2)]
- internal static extern unsafe int git_reference_ensure_log(
+ private static extern unsafe int git_reference_ensure_log(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string refname);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* refname);
[DllImport(libgit2)]
internal static extern unsafe void git_reflog_free(git_reflog* reflog);
[DllImport(libgit2)]
- internal static extern unsafe int git_reflog_read(
+ private static extern unsafe int git_reflog_read(
out git_reflog* ref_out,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
internal static extern unsafe UIntPtr git_reflog_entrycount
@@ -1147,54 +1156,54 @@ internal static extern unsafe UIntPtr git_reflog_entrycount
internal static extern unsafe git_signature* git_reflog_entry_committer(
git_reflog_entry* entry);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_reflog_entry_message(git_reflog_entry* entry);
+ [DllImport(libgit2, EntryPoint = "git_reflog_entry_message")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_reflog_entry_message_(git_reflog_entry* entry);
[DllImport(libgit2)]
- internal static extern int git_refspec_transform(
+ private static unsafe extern int git_refspec_transform(
GitBuf buf,
IntPtr refspec,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
-
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
+
[DllImport(libgit2)]
- internal static extern int git_refspec_rtransform(
+ private static unsafe extern int git_refspec_rtransform(
GitBuf buf,
IntPtr refspec,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern string git_refspec_string(
+ [DllImport(libgit2, EntryPoint = "git_refspec_string")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_refspec_string_(
IntPtr refSpec);
[DllImport(libgit2)]
internal static extern unsafe RefSpecDirection git_refspec_direction(IntPtr refSpec);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_refspec_dst(
+ [DllImport(libgit2, EntryPoint = "git_refspec_dst")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_refspec_dst_(
IntPtr refSpec);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_refspec_src(
+ [DllImport(libgit2, EntryPoint = "git_refspec_src")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_refspec_src_(
IntPtr refspec);
[DllImport(libgit2)]
internal static extern bool git_refspec_force(IntPtr refSpec);
[DllImport(libgit2)]
- internal static extern unsafe bool git_refspec_src_matches(
+ private static extern unsafe bool git_refspec_src_matches(
IntPtr refspec,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string reference);
-
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* reference);
+
[DllImport(libgit2)]
- internal static extern unsafe bool git_refspec_dst_matches(
+ private static extern unsafe bool git_refspec_dst_matches(
IntPtr refspec,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string reference);
-
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* reference);
+
[DllImport(libgit2)]
internal static extern unsafe int git_remote_autotag(git_remote* remote);
@@ -1207,38 +1216,38 @@ internal static extern unsafe int git_remote_connect(
ref GitStrArray custom_headers);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_create(
+ private static extern unsafe int git_remote_create(
out git_remote* remote,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_create_anonymous(
+ private static extern unsafe int git_remote_create_anonymous(
out git_remote* remote,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_create_with_fetchspec(
+ private static extern unsafe int git_remote_create_with_fetchspec(
out git_remote* remote,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string refspec);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* refspec);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_delete(
+ private static extern unsafe int git_remote_delete(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_fetch(
+ private static extern unsafe int git_remote_fetch(
git_remote* remote,
ref GitStrArray refspecs,
GitFetchOptions fetch_opts,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message);
[DllImport(libgit2)]
internal static extern unsafe void git_remote_free(git_remote* remote);
@@ -1262,61 +1271,61 @@ internal static extern unsafe int git_remote_push(
internal static extern unsafe UIntPtr git_remote_refspec_count(git_remote* remote);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_set_url(
+ private static extern unsafe int git_remote_set_url(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_add_fetch(
+ private static extern unsafe int git_remote_add_fetch(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_set_pushurl(
+ private static extern unsafe int git_remote_set_pushurl(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_add_push(
+ private static extern unsafe int git_remote_add_push(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url);
[DllImport(libgit2)]
- internal static extern int git_remote_is_valid_name(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote_name);
+ private static unsafe extern int git_remote_is_valid_name(
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote_name);
[DllImport(libgit2)]
internal static extern unsafe int git_remote_list(out GitStrArray array, git_repository* repo);
[DllImport(libgit2)]
- internal static extern unsafe int git_remote_lookup(
+ private static extern unsafe int git_remote_lookup(
out git_remote* remote,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name);
[DllImport(libgit2)]
internal static extern unsafe int git_remote_ls(out git_remote_head** heads, out UIntPtr size, git_remote* remote);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_remote_name(git_remote* remote);
+ [DllImport(libgit2, EntryPoint = "git_remote_name")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_remote_name_(git_remote* remote);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_remote_url(git_remote* remote);
+ [DllImport(libgit2, EntryPoint = "git_remote_url")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_remote_url_(git_remote* remote);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_remote_pushurl(git_remote* remote);
+ [DllImport(libgit2, EntryPoint = "git_remote_pushurl")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_remote_pushurl_(git_remote* remote);
[DllImport(libgit2)]
- internal static extern unsafe void git_remote_set_autotag(
+ private static extern unsafe void git_remote_set_autotag(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
TagFetchMode option);
internal delegate int remote_progress_callback(IntPtr str, int len, IntPtr data);
@@ -1341,11 +1350,11 @@ IntPtr data
);
[DllImport(libgit2)]
- internal static extern int git_repository_discover(
+ private static unsafe extern int git_repository_discover(
GitBuf buf,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath start_path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* start_path,
[MarshalAs(UnmanagedType.Bool)] bool across_fs,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath ceiling_dirs);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* ceiling_dirs);
internal delegate int git_repository_fetchhead_foreach_cb(
IntPtr remote_name,
@@ -1370,18 +1379,18 @@ internal static extern unsafe int git_repository_fetchhead_foreach(
internal static extern unsafe int git_repository_head_unborn(IntPtr repo);
[DllImport(libgit2)]
- internal static extern unsafe int git_repository_ident(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] out string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] out string email,
+ private static extern unsafe int git_repository_ident(
+ [CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] out byte* name,
+ [CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] out byte* email,
git_repository* repo);
[DllImport(libgit2)]
internal static extern unsafe int git_repository_index(out git_index* index, git_repository* repo);
[DllImport(libgit2)]
- internal static extern unsafe int git_repository_init_ext(
+ private static extern unsafe int git_repository_init_ext(
out git_repository* repository,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path,
GitRepositoryInitOptions options);
[DllImport(libgit2)]
@@ -1416,20 +1425,20 @@ internal static extern unsafe int git_repository_new(
internal static extern unsafe int git_repository_odb(out git_odb* odb, git_repository* repo);
[DllImport(libgit2)]
- internal static extern unsafe int git_repository_open(
+ private static extern unsafe int git_repository_open(
out git_repository* repository,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path);
[DllImport(libgit2)]
- internal static extern unsafe int git_repository_open_ext(
+ private static extern unsafe int git_repository_open_ext(
out git_repository* repository,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path,
RepositoryOpenFlags flags,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath ceilingDirs);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* ceilingDirs);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxFilePathNoCleanupMarshaler))]
- internal static extern unsafe FilePath git_repository_path(git_repository* repository);
+ [DllImport(libgit2, EntryPoint = "git_repository_path")]
+ [return: CustomMarshaler(typeof(LaxFilePathNoCleanupMarshaler), typeof(FilePath))]
+ private static extern unsafe byte* git_repository_path_(git_repository* repository);
[DllImport(libgit2)]
internal static extern unsafe void git_repository_set_config(
@@ -1437,10 +1446,10 @@ internal static extern unsafe void git_repository_set_config(
git_config* config);
[DllImport(libgit2)]
- internal static extern unsafe int git_repository_set_ident(
+ private static extern unsafe int git_repository_set_ident(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string email);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* email);
[DllImport(libgit2)]
@@ -1449,9 +1458,9 @@ internal static extern unsafe void git_repository_set_index(
git_index* index);
[DllImport(libgit2)]
- internal static extern unsafe int git_repository_set_workdir(
+ private static extern unsafe int git_repository_set_workdir(
git_repository* repository,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath workdir,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* workdir,
[MarshalAs(UnmanagedType.Bool)] bool update_gitlink);
[DllImport(libgit2)]
@@ -1465,21 +1474,21 @@ internal static extern unsafe int git_repository_set_head_detached_from_annotate
git_annotated_commit* commit);
[DllImport(libgit2)]
- internal static extern unsafe int git_repository_set_head(
+ private static extern unsafe int git_repository_set_head(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string refname);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* refname);
[DllImport(libgit2)]
internal static extern unsafe int git_repository_state(
git_repository* repository);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxFilePathNoCleanupMarshaler))]
- internal static extern unsafe FilePath git_repository_workdir(git_repository* repository);
+ [DllImport(libgit2, EntryPoint = "git_repository_workdir")]
+ [return: CustomMarshaler(typeof(LaxFilePathNoCleanupMarshaler), typeof(FilePath))]
+ private static extern unsafe byte* git_repository_workdir_(git_repository* repository);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxFilePathNoCleanupMarshaler))]
- internal static extern unsafe FilePath git_repository_workdir(IntPtr repository);
+ [DllImport(libgit2, EntryPoint = "git_repository_workdir")]
+ [return: CustomMarshaler(typeof(LaxFilePathNoCleanupMarshaler), typeof(FilePath))]
+ private static extern unsafe byte* git_repository_workdir_(IntPtr repository);
[DllImport(libgit2)]
internal static extern unsafe int git_reset(
@@ -1504,11 +1513,11 @@ internal static extern unsafe int git_revert_commit(
ref GitMergeOpts opts);
[DllImport(libgit2)]
- internal static extern unsafe int git_revparse_ext(
+ private static extern unsafe int git_revparse_ext(
out git_object* obj,
out git_reference* reference,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string spec);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* spec);
[DllImport(libgit2)]
internal static extern unsafe void git_revwalk_free(git_revwalk* walker);
@@ -1538,28 +1547,28 @@ internal static extern unsafe int git_revparse_ext(
internal static extern unsafe void git_signature_free(git_signature* signature);
[DllImport(libgit2)]
- internal static extern unsafe int git_signature_new(
+ private static extern unsafe int git_signature_new(
out git_signature* signature,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string email,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* email,
long time,
int offset);
[DllImport(libgit2)]
- internal static extern unsafe int git_signature_now(
+ private static extern unsafe int git_signature_now(
out git_signature* signature,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string email);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* email);
[DllImport(libgit2)]
internal static extern unsafe int git_signature_dup(out git_signature* dest, git_signature* sig);
[DllImport(libgit2)]
- internal static extern unsafe int git_stash_save(
+ private static extern unsafe int git_stash_save(
out GitOid id,
git_repository* repo,
git_signature* stasher,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message,
StashModifiers flags);
internal delegate int git_stash_cb(
@@ -1590,10 +1599,10 @@ internal static extern unsafe int git_stash_pop(
GitStashApplyOpts opts);
[DllImport(libgit2)]
- internal static extern unsafe int git_status_file(
+ private static extern unsafe int git_status_file(
out FileStatus statusflags,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath filepath);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* filepath);
[DllImport(libgit2)]
@@ -1620,16 +1629,16 @@ internal static extern void git_strarray_free(
ref GitStrArray array);
[DllImport(libgit2)]
- internal static extern unsafe int git_submodule_lookup(
+ private static extern unsafe int git_submodule_lookup(
out git_submodule* reference,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath name);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* name);
[DllImport(libgit2)]
- internal static extern unsafe int git_submodule_resolve_url(
+ private static extern unsafe int git_submodule_resolve_url(
GitBuf buf,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url);
[DllImport(libgit2)]
internal static extern unsafe int git_submodule_update(
@@ -1656,14 +1665,14 @@ internal static extern unsafe int git_submodule_add_to_index(
[DllImport(libgit2)]
internal static extern unsafe void git_submodule_free(git_submodule* submodule);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_submodule_path(
+ [DllImport(libgit2, EntryPoint = "git_submodule_path")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_submodule_path_(
git_submodule* submodule);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_submodule_url(
+ [DllImport(libgit2, EntryPoint = "git_submodule_url")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_submodule_url_(
git_submodule* submodule);
[DllImport(libgit2)]
@@ -1696,10 +1705,10 @@ internal static extern unsafe int git_submodule_reload(
[MarshalAs(UnmanagedType.Bool)] bool force);
[DllImport(libgit2)]
- internal static extern unsafe int git_submodule_status(
+ private static extern unsafe int git_submodule_status(
out SubmoduleStatus status,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath name,
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* name,
GitSubmoduleIgnore ignore);
[DllImport(libgit2)]
@@ -1708,49 +1717,49 @@ internal static extern unsafe int git_submodule_init(
[MarshalAs(UnmanagedType.Bool)] bool overwrite);
[DllImport(libgit2)]
- internal static extern unsafe int git_tag_annotation_create(
+ private static extern unsafe int git_tag_annotation_create(
out GitOid oid,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
git_object* target,
git_signature* signature,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message);
[DllImport(libgit2)]
- internal static extern unsafe int git_tag_create(
+ private static extern unsafe int git_tag_create(
out GitOid oid,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
git_object* target,
git_signature* signature,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message,
[MarshalAs(UnmanagedType.Bool)]
bool force);
[DllImport(libgit2)]
- internal static extern unsafe int git_tag_create_lightweight(
+ private static extern unsafe int git_tag_create_lightweight(
out GitOid oid,
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name,
git_object* target,
[MarshalAs(UnmanagedType.Bool)]
bool force);
[DllImport(libgit2)]
- internal static extern unsafe int git_tag_delete(
+ private static extern unsafe int git_tag_delete(
git_repository* repo,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string tagName);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* tagName);
[DllImport(libgit2)]
internal static extern unsafe int git_tag_list(out GitStrArray array, git_repository* repo);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_tag_message(git_object* tag);
+ [DllImport(libgit2, EntryPoint = "git_tag_message")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_tag_message_(git_object* tag);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_tag_name(git_object* tag);
+ [DllImport(libgit2, EntryPoint = "git_tag_name")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_tag_name_(git_object* tag);
[DllImport(libgit2)]
internal static extern unsafe git_signature* git_tag_tagger(git_object* tag);
@@ -1782,8 +1791,8 @@ internal static extern unsafe int git_tag_delete(
internal unsafe delegate int git_transport_certificate_check_cb(git_certificate* cert, int valid, IntPtr hostname, IntPtr payload);
[DllImport(libgit2)]
- internal static extern int git_transport_register(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string prefix,
+ private static unsafe extern int git_transport_register(
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* prefix,
IntPtr transport_cb,
IntPtr payload);
@@ -1794,22 +1803,22 @@ internal static extern int git_transport_smart(
IntPtr definition);
[DllImport(libgit2)]
- internal static extern int git_transport_smart_certificate_check(
+ private static unsafe extern int git_transport_smart_certificate_check(
IntPtr transport,
IntPtr cert,
int valid,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string hostname);
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* hostname);
[DllImport(libgit2)]
- internal static extern int git_transport_smart_credentials(
+ private static unsafe extern int git_transport_smart_credentials(
out IntPtr cred_out,
IntPtr transport,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string user,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* user,
int methods);
[DllImport(libgit2)]
- internal static extern int git_transport_unregister(
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string prefix);
+ private static unsafe extern int git_transport_unregister(
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* prefix);
[DllImport(libgit2)]
internal static extern unsafe uint git_tree_entry_filemode(git_tree_entry* entry);
@@ -1818,10 +1827,10 @@ internal static extern int git_transport_unregister(
internal static extern unsafe git_tree_entry* git_tree_entry_byindex(git_object* tree, UIntPtr idx);
[DllImport(libgit2)]
- internal static extern unsafe int git_tree_entry_bypath(
+ private static extern unsafe int git_tree_entry_bypath(
out git_tree_entry* tree,
git_object* root,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath treeentry_path);
+ [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* treeentry_path);
[DllImport(libgit2)]
internal static extern unsafe void git_tree_entry_free(git_tree_entry* treeEntry);
@@ -1829,9 +1838,9 @@ internal static extern unsafe int git_tree_entry_bypath(
[DllImport(libgit2)]
internal static extern unsafe git_oid* git_tree_entry_id(git_tree_entry* entry);
- [DllImport(libgit2)]
- [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
- internal static extern unsafe string git_tree_entry_name(git_tree_entry* entry);
+ [DllImport(libgit2, EntryPoint = "git_tree_entry_name")]
+ [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
+ private static extern unsafe byte* git_tree_entry_name_(git_tree_entry* entry);
[DllImport(libgit2)]
internal static extern unsafe GitObjectType git_tree_entry_type(git_tree_entry* entry);
@@ -1843,10 +1852,10 @@ internal static extern unsafe int git_tree_entry_bypath(
internal static extern unsafe int git_treebuilder_new(out git_treebuilder* builder, git_repository* repo, IntPtr src);
[DllImport(libgit2)]
- internal static extern unsafe int git_treebuilder_insert(
+ private static extern unsafe int git_treebuilder_insert(
IntPtr entry_out,
git_treebuilder* builder,
- [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string treeentry_name,
+ [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* treeentry_name,
ref GitOid id,
uint attributes);
diff --git a/LibGit2Sharp/Core/Platform.cs b/LibGit2Sharp/Core/Platform.cs
index 1f43b6a24..19aed7ccb 100644
--- a/LibGit2Sharp/Core/Platform.cs
+++ b/LibGit2Sharp/Core/Platform.cs
@@ -1,4 +1,6 @@
using System;
+using System.IO;
+using System.Runtime.InteropServices;
namespace LibGit2Sharp.Core
{
@@ -11,29 +13,68 @@ internal enum OperatingSystemType
internal static class Platform
{
+ private static Lazy _operatingSystem = new Lazy(
+ DetermineOperatingSystem,
+ System.Threading.LazyThreadSafetyMode.PublicationOnly);
+
public static string ProcessorArchitecture
{
- get { return Environment.Is64BitProcess ? "x64" : "x86"; }
+ get { return IntPtr.Size == 8 ? "x64" : "x86"; }
}
- public static OperatingSystemType OperatingSystem
+ public static OperatingSystemType OperatingSystem => _operatingSystem.Value;
+
+ private static OperatingSystemType DetermineOperatingSystem()
{
- get
+#if DESKTOP
+ // See http://www.mono-project.com/docs/faq/technical/#how-to-detect-the-execution-platform
+ switch ((int)Environment.OSVersion.Platform)
+ {
+ case 4:
+ case 128:
+ return OperatingSystemType.Unix;
+
+ case 6:
+ return OperatingSystemType.MacOSX;
+
+ default:
+ return OperatingSystemType.Windows;
+ }
+#else
+ try
+ {
+ return OperatingSystem_CoreFxStyle();
+ }
+ catch (FileNotFoundException)
+ {
+ // We're probably running on .NET 4.6.1 or earlier where the API isn't available.
+ // This would suggest we're running on Windows. Although if our portable library
+ // is being used on mono, it could be *nix or OSX too.
+ return OperatingSystemType.Windows;
+ }
+#endif
+ }
+
+#if !DESKTOP
+ private static OperatingSystemType OperatingSystem_CoreFxStyle()
+ {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ return OperatingSystemType.Windows;
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ return OperatingSystemType.Unix;
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ return OperatingSystemType.MacOSX;
+ }
+ else
{
- // See http://www.mono-project.com/docs/faq/technical/#how-to-detect-the-execution-platform
- switch ((int)Environment.OSVersion.Platform)
- {
- case 4:
- case 128:
- return OperatingSystemType.Unix;
-
- case 6:
- return OperatingSystemType.MacOSX;
-
- default:
- return OperatingSystemType.Windows;
- }
+ throw new InvalidOperationException();
}
}
+#endif
}
}
diff --git a/LibGit2Sharp/Core/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs
index e73e5a83b..6146f0482 100644
--- a/LibGit2Sharp/Core/Proxy.cs
+++ b/LibGit2Sharp/Core/Proxy.cs
@@ -570,7 +570,7 @@ public static FilePath git_config_find_programdata()
{
return ConvertPath(NativeMethods.git_config_find_programdata);
}
-
+
public static unsafe void git_config_free(git_config *config)
{
NativeMethods.git_config_free(config);
@@ -1603,16 +1603,21 @@ public static unsafe ObjectId git_odb_write(ObjectDatabaseHandle odb, byte[] dat
int res;
fixed(byte* p = data)
{
- res = NativeMethods.git_odb_write(out id, odb, p, new UIntPtr((ulong)data.LongLength), type.ToGitObjectType());
+#if DESKTOP
+ UIntPtr len = new UIntPtr((ulong)data.LongLength);
+#else
+ UIntPtr len = new UIntPtr((uint)data.Length);
+#endif
+ res = NativeMethods.git_odb_write(out id, odb, p, len, type.ToGitObjectType());
}
Ensure.ZeroResult(res);
return id;
}
- #endregion
+#endregion
- #region git_patch_
+#region git_patch_
public static unsafe PatchHandle git_patch_from_diff(DiffHandle diff, int idx)
{
@@ -1636,9 +1641,9 @@ public static unsafe Tuple git_patch_line_stats(PatchHandle patch)
return new Tuple((int)add, (int)del);
}
- #endregion
+#endregion
- #region git_packbuilder_
+#region git_packbuilder_
public static unsafe PackBuilderHandle git_packbuilder_new(RepositoryHandle repo)
{
@@ -1702,9 +1707,9 @@ public static unsafe UIntPtr git_packbuilder_written(PackBuilderHandle packbuild
{
return NativeMethods.git_packbuilder_written(packbuilder);
}
- #endregion
+#endregion
- #region git_rebase
+#region git_rebase
public static unsafe RebaseHandle git_rebase_init(
RepositoryHandle repo,
@@ -1858,9 +1863,9 @@ public static unsafe void git_rebase_finish(
}
}
- #endregion
+#endregion
- #region git_reference_
+#region git_reference_
public static unsafe ReferenceHandle git_reference_create(
RepositoryHandle repo,
@@ -2008,9 +2013,9 @@ public static unsafe void git_reference_ensure_log(RepositoryHandle repo, string
Ensure.ZeroResult(res);
}
- #endregion
+#endregion
- #region git_reflog_
+#region git_reflog_
public static unsafe ReflogHandle git_reflog_read(RepositoryHandle repo, string canonicalName)
{
@@ -2052,9 +2057,9 @@ public static unsafe string git_reflog_entry_message(git_reflog_entry* entry)
return NativeMethods.git_reflog_entry_message(entry);
}
- #endregion
+#endregion
- #region git_refspec
+#region git_refspec
public static unsafe string git_refspec_transform(IntPtr refSpecPtr, string name)
{
@@ -2113,9 +2118,9 @@ public static bool git_refspec_dst_matches(IntPtr refspec, string reference)
return NativeMethods.git_refspec_dst_matches(refspec, reference);
}
- #endregion
+#endregion
- #region git_remote_
+#region git_remote_
public static unsafe TagFetchMode git_remote_autotag(RemoteHandle remote)
{
@@ -2426,9 +2431,9 @@ public static unsafe string git_remote_pushurl(RemoteHandle remote)
return NativeMethods.git_remote_pushurl(remote);
}
- #endregion
+#endregion
- #region git_repository_
+#region git_repository_
public static FilePath git_repository_discover(FilePath start_path)
{
@@ -2637,9 +2642,9 @@ public static unsafe void git_repository_set_head(RepositoryHandle repo, string
Ensure.ZeroResult(res);
}
- #endregion
+#endregion
- #region git_reset_
+#region git_reset_
public static unsafe void git_reset(
RepositoryHandle repo,
@@ -2654,9 +2659,9 @@ public static unsafe void git_reset(
}
}
- #endregion
+#endregion
- #region git_revert_
+#region git_revert_
public static unsafe void git_revert(
RepositoryHandle repo,
@@ -2726,9 +2731,9 @@ public static ObjectHandle git_revparse_single(RepositoryHandle repo, string obj
return handles.Item1;
}
- #endregion
+#endregion
- #region git_revwalk_
+#region git_revwalk_
public static unsafe void git_revwalk_hide(RevWalkerHandle walker, ObjectId commit_id)
{
@@ -2783,9 +2788,9 @@ public static unsafe void git_revwalk_simplify_first_parent(RevWalkerHandle walk
NativeMethods.git_revwalk_simplify_first_parent(walker);
}
- #endregion
+#endregion
- #region git_signature_
+#region git_signature_
public static unsafe SignatureHandle git_signature_new(string name, string email, DateTimeOffset when)
{
@@ -2815,9 +2820,9 @@ public static unsafe SignatureHandle git_signature_now(string name, string email
return handle;
}
- #endregion
+#endregion
- #region git_stash_
+#region git_stash_
public static unsafe ObjectId git_stash_save(
RepositoryHandle repo,
@@ -2897,9 +2902,9 @@ public static unsafe StashApplyStatus git_stash_pop(
return get_stash_status(NativeMethods.git_stash_pop(repo, (UIntPtr)index, opts));
}
- #endregion
+#endregion
- #region git_status_
+#region git_status_
public static unsafe FileStatus git_status_file(RepositoryHandle repo, FilePath path)
{
@@ -2945,9 +2950,9 @@ public static unsafe int git_status_list_entrycount(StatusListHandle list)
return NativeMethods.git_status_byindex(list, (UIntPtr)idx);
}
- #endregion
+#endregion
- #region git_submodule_
+#region git_submodule_
///
/// Returns a handle to the corresponding submodule,
@@ -3059,9 +3064,9 @@ public static unsafe void git_submodule_init(SubmoduleHandle submodule, bool ove
Ensure.ZeroResult(res);
}
- #endregion
+#endregion
- #region git_tag_
+#region git_tag_
public static unsafe ObjectId git_tag_annotation_create(
RepositoryHandle repo,
@@ -3170,9 +3175,9 @@ public static unsafe GitObjectType git_tag_target_type(ObjectHandle tag)
return NativeMethods.git_tag_target_type(tag);
}
- #endregion
+#endregion
- #region git_trace_
+#region git_trace_
///
/// Install/Enable logging inside of LibGit2 to send messages back to LibGit2Sharp.
@@ -3192,9 +3197,9 @@ public static void git_trace_set(LogLevel level, NativeMethods.git_trace_cb call
Ensure.ZeroResult(res);
}
- #endregion
+#endregion
- #region git_transport_
+#region git_transport_
public static void git_transport_register(String prefix, IntPtr transport_cb, IntPtr param)
{
@@ -3221,18 +3226,18 @@ public static void git_transport_unregister(String prefix)
Ensure.ZeroResult(res);
}
- #endregion
+#endregion
- #region git_transport_smart_
+#region git_transport_smart_
public static int git_transport_smart_credentials(out IntPtr cred, IntPtr transport, string user, int methods)
{
return NativeMethods.git_transport_smart_credentials(out cred, transport, user, methods);
}
- #endregion
+#endregion
- #region git_tree_
+#region git_tree_
public static unsafe Mode git_tree_entry_attributes(git_tree_entry* entry)
{
@@ -3288,9 +3293,9 @@ public static unsafe int git_tree_entrycount(ObjectHandle tree)
return (int)NativeMethods.git_tree_entrycount(tree);
}
- #endregion
+#endregion
- #region git_treebuilder_
+#region git_treebuilder_
public static unsafe TreeBuilderHandle git_treebuilder_new(RepositoryHandle repo)
{
@@ -3318,9 +3323,9 @@ public static unsafe ObjectId git_treebuilder_write(TreeBuilderHandle bld)
return oid;
}
- #endregion
+#endregion
- #region git_transaction_
+#region git_transaction_
public static void git_transaction_commit(IntPtr txn)
{
@@ -3332,9 +3337,9 @@ public static void git_transaction_free(IntPtr txn)
NativeMethods.git_transaction_free(txn);
}
- #endregion
+#endregion
- #region git_libgit2_
+#region git_libgit2_
///
/// Returns the features with which libgit2 was compiled.
@@ -3413,7 +3418,7 @@ public static void git_libgit2_opts_set_search_path(ConfigurationLevel level, st
Ensure.ZeroResult(res);
}
- #endregion
+#endregion
private static ICollection git_foreach(
Func resultSelector,
diff --git a/LibGit2Sharp/Core/Utf8Marshaler.cs b/LibGit2Sharp/Core/Utf8Marshaler.cs
index fbe127abf..53e14f4ec 100644
--- a/LibGit2Sharp/Core/Utf8Marshaler.cs
+++ b/LibGit2Sharp/Core/Utf8Marshaler.cs
@@ -11,15 +11,13 @@ namespace LibGit2Sharp.Core
/// free the native pointer after conversion, because the memory is owned by libgit2.
///
/// Use this marshaler for return values, for example:
- /// [return: MarshalAs(UnmanagedType.CustomMarshaler,
- /// MarshalCookie = UniqueId.UniqueIdentifier,
- /// MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))]
+ /// [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))]
///
internal class LaxUtf8NoCleanupMarshaler : LaxUtf8Marshaler
{
private static readonly LaxUtf8NoCleanupMarshaler staticInstance = new LaxUtf8NoCleanupMarshaler();
- public new static ICustomMarshaler GetInstance(String cookie)
+ public new static ICustomMarshaler GetInstance()
{
return staticInstance;
}
@@ -41,10 +39,9 @@ public override void CleanUpNativeData(IntPtr pNativeData)
///
/// Use this marshaler for function parameters, for example:
/// [DllImport(libgit2)]
- /// internal static extern int git_tag_delete(RepositorySafeHandle repo,
- /// [MarshalAs(UnmanagedType.CustomMarshaler,
- /// MarshalCookie = UniqueId.UniqueIdentifier,
- /// MarshalTypeRef = typeof(StrictUtf8Marshaler))] String tagName);
+ /// private static extern unsafe int git_tag_delete(
+ /// git_repository* repo,
+ /// [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* tagName);
///
internal class StrictUtf8Marshaler : EncodingMarshaler
{
@@ -60,7 +57,7 @@ static StrictUtf8Marshaler()
public StrictUtf8Marshaler() : base(encoding)
{ }
- public static ICustomMarshaler GetInstance(String cookie)
+ public static ICustomMarshaler GetInstance()
{
return staticInstance;
}
@@ -96,7 +93,7 @@ internal class LaxUtf8Marshaler : EncodingMarshaler
public LaxUtf8Marshaler() : base(Encoding)
{ }
- public static ICustomMarshaler GetInstance(String cookie)
+ public static ICustomMarshaler GetInstance()
{
return staticInstance;
}
diff --git a/LibGit2Sharp/EmptyCommitException.cs b/LibGit2Sharp/EmptyCommitException.cs
index 8cd48e49f..b5e96a66b 100644
--- a/LibGit2Sharp/EmptyCommitException.cs
+++ b/LibGit2Sharp/EmptyCommitException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
namespace LibGit2Sharp
{
@@ -7,7 +9,9 @@ namespace LibGit2Sharp
/// The exception that is thrown when a commit would create an "empty"
/// commit that is treesame to its parent without an explicit override.
///
+#if DESKTOP
[Serializable]
+#endif
public class EmptyCommitException : LibGit2SharpException
{
///
@@ -42,6 +46,7 @@ public EmptyCommitException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -50,5 +55,6 @@ public EmptyCommitException(string message, Exception innerException)
protected EmptyCommitException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
}
}
diff --git a/LibGit2Sharp/EntryExistsException.cs b/LibGit2Sharp/EntryExistsException.cs
index 2c46e4acd..d8a5208f9 100644
--- a/LibGit2Sharp/EntryExistsException.cs
+++ b/LibGit2Sharp/EntryExistsException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -7,7 +9,9 @@ namespace LibGit2Sharp
///
/// The exception that is thrown attempting to create a resource that already exists.
///
+#if DESKTOP
[Serializable]
+#endif
public class EntryExistsException : LibGit2SharpException
{
///
@@ -42,6 +46,7 @@ public EntryExistsException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -50,6 +55,7 @@ public EntryExistsException(string message, Exception innerException)
protected EntryExistsException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal EntryExistsException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/GlobalSettings.cs b/LibGit2Sharp/GlobalSettings.cs
index 8fac7877f..ddec9fac5 100644
--- a/LibGit2Sharp/GlobalSettings.cs
+++ b/LibGit2Sharp/GlobalSettings.cs
@@ -23,6 +23,7 @@ static GlobalSettings()
{
if (Platform.OperatingSystem == OperatingSystemType.Windows)
{
+#if DESKTOP
/* Assembly.CodeBase is not actually a correctly formatted
* URI. It's merely prefixed with `file:///` and has its
* backslashes flipped. This is superior to EscapedCodeBase,
@@ -43,7 +44,12 @@ static GlobalSettings()
managedPath = @"\\" + managedPath.Substring(7).Replace('/', '\\');
}
- nativeLibraryPath = Path.Combine(Path.Combine(Path.GetDirectoryName(managedPath), "lib"), "win32");
+ managedPath = Path.GetDirectoryName(managedPath);
+#else
+ string managedPath = AppContext.BaseDirectory;
+#endif
+
+ nativeLibraryPath = Path.Combine(managedPath, "lib", "win32");
}
registeredFilters = new Dictionary();
diff --git a/LibGit2Sharp/ICustomMarshaler.cs b/LibGit2Sharp/ICustomMarshaler.cs
new file mode 100644
index 000000000..29cfec215
--- /dev/null
+++ b/LibGit2Sharp/ICustomMarshaler.cs
@@ -0,0 +1,21 @@
+#if NETSTANDARD1_3
+
+using System;
+
+namespace LibGit2Sharp
+{
+ internal interface ICustomMarshaler
+ {
+ Object MarshalNativeToManaged(IntPtr pNativeData);
+
+ IntPtr MarshalManagedToNative(Object ManagedObj);
+
+ void CleanUpNativeData(IntPtr pNativeData);
+
+ void CleanUpManagedData(Object ManagedObj);
+
+ int GetNativeDataSize();
+ }
+}
+
+#endif
diff --git a/LibGit2Sharp/InvalidSpecificationException.cs b/LibGit2Sharp/InvalidSpecificationException.cs
index 64654852c..f3374e9e2 100644
--- a/LibGit2Sharp/InvalidSpecificationException.cs
+++ b/LibGit2Sharp/InvalidSpecificationException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -10,7 +12,9 @@ namespace LibGit2Sharp
/// if the spec refers to an object of an incorrect type (e.g. asking to
/// create a branch from a blob, or peeling a blob to a commit).
///
+#if DESKTOP
[Serializable]
+#endif
public class InvalidSpecificationException : LibGit2SharpException
{
///
@@ -45,6 +49,7 @@ public InvalidSpecificationException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -53,6 +58,7 @@ public InvalidSpecificationException(string message, Exception innerException)
protected InvalidSpecificationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal InvalidSpecificationException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj
index 34fb0d630..f3fb18896 100644
--- a/LibGit2Sharp/LibGit2Sharp.csproj
+++ b/LibGit2Sharp/LibGit2Sharp.csproj
@@ -1,397 +1,55 @@
-
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {EE6ED99F-CB12-4683-B055-D28FC7357A34}
- Library
- Properties
- LibGit2Sharp
- LibGit2Sharp
- v4.0
- 512
-
-
-
-
-
- true
- full
- false
- bin\Debug\
- TRACE;DEBUG;NET40
- prompt
- 4
- true
- AllRules.ruleset
- bin\Debug\LibGit2Sharp.xml
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- true
- bin\Release\LibGit2Sharp.xml
-
+
+ net40;netstandard1.3
+ true
+ LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono.
+ LibGit2Sharp contributors
+ libgit2 git
+ https://github.com/libgit2/libgit2sharp/
+ LibGit2Sharp contributors
+
true
+ ..\libgit2sharp.snk
+ true
+ $(DefineConstants);DESKTOP
-
- libgit2sharp.snk
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Code
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ TextTemplatingFileGenerator
+ Objects.cs
+
+
+
+
+
+
Objects.tt
-
-
-
-
-
-
-
-
-
-
+
-
+
+
+
+
+
+
-
-
-
- TextTemplatingFileGenerator
- Objects.cs
-
-
+
+
+
+
-
-
-
+
-
-
-
-
-
-
-
+
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+ https://github.com/libgit2/libgit2sharp/raw/$(GitCommitIdShort)/square-logo.png
+ https://github.com/libgit2/libgit2sharp/blob/$(GitCommitIdShort)/CHANGES.md#libgit2sharp-changes
+ https://github.com/libgit2/libgit2sharp/raw/$(GitCommitIdShort)/LICENSE.md
-
diff --git a/LibGit2Sharp/LibGit2SharpException.cs b/LibGit2Sharp/LibGit2SharpException.cs
index e85dd638f..1fcf1a3ae 100644
--- a/LibGit2Sharp/LibGit2SharpException.cs
+++ b/LibGit2Sharp/LibGit2SharpException.cs
@@ -1,6 +1,8 @@
using System;
using System.Globalization;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -8,7 +10,9 @@ namespace LibGit2Sharp
///
/// The exception that is thrown when an error occurs during application execution.
///
+#if DESKTOP
[Serializable]
+#endif
public class LibGit2SharpException : Exception
{
///
@@ -44,6 +48,7 @@ public LibGit2SharpException(string format, params object[] args)
{
}
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -52,6 +57,7 @@ public LibGit2SharpException(string format, params object[] args)
protected LibGit2SharpException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal LibGit2SharpException(string message, GitErrorCode code, GitErrorCategory category) : this(message)
{
diff --git a/LibGit2Sharp/LockedFileException.cs b/LibGit2Sharp/LockedFileException.cs
index 05859503a..6a327b620 100644
--- a/LibGit2Sharp/LockedFileException.cs
+++ b/LibGit2Sharp/LockedFileException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -7,7 +9,9 @@ namespace LibGit2Sharp
///
/// The exception that is thrown attempting to open a locked file.
///
+#if DESKTOP
[Serializable]
+#endif
public class LockedFileException : LibGit2SharpException
{
///
@@ -42,6 +46,7 @@ public LockedFileException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -50,6 +55,7 @@ public LockedFileException(string message, Exception innerException)
protected LockedFileException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal LockedFileException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/MergeFetchHeadNotFoundException.cs b/LibGit2Sharp/MergeFetchHeadNotFoundException.cs
index a86bf5caf..17393a38f 100644
--- a/LibGit2Sharp/MergeFetchHeadNotFoundException.cs
+++ b/LibGit2Sharp/MergeFetchHeadNotFoundException.cs
@@ -1,12 +1,16 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
namespace LibGit2Sharp
{
///
/// The exception that is thrown when the ref to merge with was as part of a pull operation not fetched.
///
+#if DESKTOP
[Serializable]
+#endif
public class MergeFetchHeadNotFoundException : NotFoundException
{
///
@@ -41,6 +45,7 @@ public MergeFetchHeadNotFoundException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -49,5 +54,6 @@ public MergeFetchHeadNotFoundException(string message, Exception innerException)
protected MergeFetchHeadNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
}
}
diff --git a/LibGit2Sharp/NameConflictException.cs b/LibGit2Sharp/NameConflictException.cs
index 815415729..88415c225 100644
--- a/LibGit2Sharp/NameConflictException.cs
+++ b/LibGit2Sharp/NameConflictException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -7,7 +9,9 @@ namespace LibGit2Sharp
///
/// The exception that is thrown when a reference, a remote, a submodule... with the same name already exists in the repository
///
+#if DESKTOP
[Serializable]
+#endif
public class NameConflictException : LibGit2SharpException
{
///
@@ -42,6 +46,7 @@ public NameConflictException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -50,6 +55,7 @@ public NameConflictException(string message, Exception innerException)
protected NameConflictException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal NameConflictException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/NativeDllName.targets b/LibGit2Sharp/NativeDllName.targets
deleted file mode 100644
index a6afed504..000000000
--- a/LibGit2Sharp/NativeDllName.targets
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
- .
- $(MSBuildThisFileDirectory)
- $(LibGit2SharpPath)\Core\NativeDllName.cs
- $(CoreCompileDependsOn);GenerateNativeDllNameCs
- $(CoreCleanDependsOn);CleanNativeDllNameCs
-
-
-
-
-
-
-
-
-
-
diff --git a/LibGit2Sharp/NonFastForwardException.cs b/LibGit2Sharp/NonFastForwardException.cs
index 487e8fd03..e01ef0bb4 100644
--- a/LibGit2Sharp/NonFastForwardException.cs
+++ b/LibGit2Sharp/NonFastForwardException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -8,7 +10,9 @@ namespace LibGit2Sharp
/// The exception that is thrown when push cannot be performed
/// against the remote without losing commits.
///
+#if DESKTOP
[Serializable]
+#endif
public class NonFastForwardException : LibGit2SharpException
{
///
@@ -43,6 +47,7 @@ public NonFastForwardException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -51,6 +56,7 @@ public NonFastForwardException(string message, Exception innerException)
protected NonFastForwardException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal NonFastForwardException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/NotFoundException.cs b/LibGit2Sharp/NotFoundException.cs
index 0e9b45bf3..82015a7f1 100644
--- a/LibGit2Sharp/NotFoundException.cs
+++ b/LibGit2Sharp/NotFoundException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -7,7 +9,9 @@ namespace LibGit2Sharp
///
/// The exception that is thrown attempting to reference a resource that does not exist.
///
+#if DESKTOP
[Serializable]
+#endif
public class NotFoundException : LibGit2SharpException
{
///
@@ -42,6 +46,7 @@ public NotFoundException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -50,6 +55,7 @@ public NotFoundException(string message, Exception innerException)
protected NotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal NotFoundException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/ObjectId.cs b/LibGit2Sharp/ObjectId.cs
index c04100fe9..9d754781c 100644
--- a/LibGit2Sharp/ObjectId.cs
+++ b/LibGit2Sharp/ObjectId.cs
@@ -330,7 +330,7 @@ private static bool LooksValid(string objectId, bool throwIfInvalid)
"objectId");
}
- return objectId.All(c => hexDigits.Contains(c.ToString(CultureInfo.InvariantCulture)));
+ return objectId.All(c => hexDigits.IndexOf(c) >= 0);
}
///
diff --git a/LibGit2Sharp/PeelException.cs b/LibGit2Sharp/PeelException.cs
index 09d6bdcc8..21d81a4c4 100644
--- a/LibGit2Sharp/PeelException.cs
+++ b/LibGit2Sharp/PeelException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -8,7 +10,9 @@ namespace LibGit2Sharp
/// The exception that is thrown when a tag cannot be peeled to the
/// target type due to the object model.
///
+#if DESKTOP
[Serializable]
+#endif
public class PeelException : LibGit2SharpException
{
///
@@ -43,6 +47,7 @@ public PeelException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -51,6 +56,7 @@ public PeelException(string message, Exception innerException)
protected PeelException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal PeelException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/PortableShims.cs b/LibGit2Sharp/PortableShims.cs
new file mode 100644
index 000000000..220bbf642
--- /dev/null
+++ b/LibGit2Sharp/PortableShims.cs
@@ -0,0 +1,19 @@
+#if DESKTOP
+
+using System;
+
+namespace LibGit2Sharp
+{
+ ///
+ /// Allows portable-compatible code that uses GetTypeInfo() to compile and work on net40.
+ ///
+ internal static class PortableShims
+ {
+ ///
+ /// Returns the specified type.
+ ///
+ internal static Type GetTypeInfo(this Type type) => type;
+ }
+}
+
+#endif
diff --git a/LibGit2Sharp/Properties/AssemblyInfo.cs b/LibGit2Sharp/Properties/AssemblyInfo.cs
index 18643022e..ea5861dbd 100644
--- a/LibGit2Sharp/Properties/AssemblyInfo.cs
+++ b/LibGit2Sharp/Properties/AssemblyInfo.cs
@@ -6,17 +6,6 @@
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("LibGit2Sharp")]
-[assembly: AssemblyDescription("LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono.")]
-[assembly: AssemblyCompany("LibGit2Sharp contributors")]
-
-#if DEBUG
-[assembly: AssemblyConfiguration("Debug")]
-#else
-[assembly: AssemblyConfiguration("Release")]
-#endif
-
-[assembly: AssemblyProduct("LibGit2Sharp")]
[assembly: AssemblyCopyright("Copyright © LibGit2Sharp contributors")]
[assembly: CLSCompliant(true)]
@@ -30,18 +19,3 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c6f71967-5be1-49f5-b48e-861bff498ea3")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-
-[assembly: AssemblyVersion("0.24.0")]
-[assembly: AssemblyFileVersion("0.24.0")]
-[assembly: AssemblyInformationalVersion("0.24.0-dev00000000000000")]
diff --git a/LibGit2Sharp/RecurseSubmodulesException.cs b/LibGit2Sharp/RecurseSubmodulesException.cs
index c322f7605..3499519dd 100644
--- a/LibGit2Sharp/RecurseSubmodulesException.cs
+++ b/LibGit2Sharp/RecurseSubmodulesException.cs
@@ -1,4 +1,7 @@
using System;
+#if DESKTOP
+using System.Runtime.Serialization;
+#endif
namespace LibGit2Sharp
{
@@ -7,7 +10,9 @@ namespace LibGit2Sharp
/// through submodules. The inner exception contains the exception that was
/// initially thrown while operating on the submodule.
///
+#if DESKTOP
[Serializable]
+#endif
public class RecurseSubmodulesException : LibGit2SharpException
{
///
@@ -32,5 +37,16 @@ public RecurseSubmodulesException(string message, Exception innerException, stri
{
InitialRepositoryPath = initialRepositoryPath;
}
+
+#if DESKTOP
+ ///
+ /// Initializes a new instance of the class with a serialized data.
+ ///
+ /// The that holds the serialized object data about the exception being thrown.
+ /// The that contains contextual information about the source or destination.
+ protected RecurseSubmodulesException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ { }
+#endif
}
}
diff --git a/LibGit2Sharp/RemoveFromIndexException.cs b/LibGit2Sharp/RemoveFromIndexException.cs
index 6d9718c18..eca11eb3e 100644
--- a/LibGit2Sharp/RemoveFromIndexException.cs
+++ b/LibGit2Sharp/RemoveFromIndexException.cs
@@ -1,13 +1,17 @@
using System;
using System.Globalization;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
namespace LibGit2Sharp
{
///
/// The exception that is thrown when a file cannot be removed from the index.
///
+#if DESKTOP
[Serializable]
+#endif
public class RemoveFromIndexException : LibGit2SharpException
{
///
@@ -43,6 +47,7 @@ public RemoveFromIndexException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -51,5 +56,6 @@ public RemoveFromIndexException(string message, Exception innerException)
protected RemoveFromIndexException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
}
}
diff --git a/LibGit2Sharp/RepositoryNotFoundException.cs b/LibGit2Sharp/RepositoryNotFoundException.cs
index 2255c0891..10a0742f3 100644
--- a/LibGit2Sharp/RepositoryNotFoundException.cs
+++ b/LibGit2Sharp/RepositoryNotFoundException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
namespace LibGit2Sharp
{
@@ -7,7 +9,9 @@ namespace LibGit2Sharp
/// The exception that is thrown when a is being built with
/// a path that doesn't point at a valid Git repository or workdir.
///
+#if DESKTOP
[Serializable]
+#endif
public class RepositoryNotFoundException : LibGit2SharpException
{
///
@@ -42,6 +46,7 @@ public RepositoryNotFoundException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -50,5 +55,6 @@ public RepositoryNotFoundException(string message, Exception innerException)
protected RepositoryNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
}
}
diff --git a/LibGit2Sharp/SecureUsernamePasswordCredentials.cs b/LibGit2Sharp/SecureUsernamePasswordCredentials.cs
index 16427ddf3..09ed2310d 100644
--- a/LibGit2Sharp/SecureUsernamePasswordCredentials.cs
+++ b/LibGit2Sharp/SecureUsernamePasswordCredentials.cs
@@ -26,7 +26,11 @@ protected internal override int GitCredentialHandler(out IntPtr cred)
try
{
+#if DESKTOP
passwordPtr = Marshal.SecureStringToGlobalAllocUnicode(Password);
+#else
+ passwordPtr = SecureStringMarshal.SecureStringToCoTaskMemUnicode(Password);
+#endif
return NativeMethods.git_cred_userpass_plaintext_new(out cred, Username, Marshal.PtrToStringUni(passwordPtr));
}
diff --git a/LibGit2Sharp/SmartSubtransportRegistration.cs b/LibGit2Sharp/SmartSubtransportRegistration.cs
index 2c017dc57..cc756885a 100644
--- a/LibGit2Sharp/SmartSubtransportRegistration.cs
+++ b/LibGit2Sharp/SmartSubtransportRegistration.cs
@@ -1,4 +1,5 @@
using System;
+using System.Reflection;
using System.Runtime.InteropServices;
using LibGit2Sharp.Core;
using LibGit2Sharp.Core.Handles;
@@ -39,7 +40,7 @@ private IntPtr CreateRegistrationPointer()
var registration = new GitSmartSubtransportRegistration();
registration.SubtransportCallback = Marshal.GetFunctionPointerForDelegate(EntryPoints.SubtransportCallback);
- registration.Rpc = typeof(RpcSmartSubtransport).IsAssignableFrom(typeof(T)) ? (uint)1 : (uint)0;
+ registration.Rpc = typeof(RpcSmartSubtransport).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()) ? (uint)1 : (uint)0;
var registrationPointer = Marshal.AllocHGlobal(Marshal.SizeOf(registration));
Marshal.StructureToPtr(registration, registrationPointer, false);
diff --git a/LibGit2Sharp/UnbornBranchException.cs b/LibGit2Sharp/UnbornBranchException.cs
index 099704e8d..ab4bccd52 100644
--- a/LibGit2Sharp/UnbornBranchException.cs
+++ b/LibGit2Sharp/UnbornBranchException.cs
@@ -1,6 +1,8 @@
using System;
using System.Globalization;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
namespace LibGit2Sharp
{
@@ -8,7 +10,9 @@ namespace LibGit2Sharp
/// The exception that is thrown when a operation requiring an existing
/// branch is performed against an unborn branch.
///
+#if DESKTOP
[Serializable]
+#endif
public class UnbornBranchException : LibGit2SharpException
{
///
@@ -43,6 +47,7 @@ public UnbornBranchException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -51,5 +56,6 @@ public UnbornBranchException(string message, Exception innerException)
protected UnbornBranchException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
}
}
diff --git a/LibGit2Sharp/UniqueIdentifier.targets b/LibGit2Sharp/UniqueIdentifier.targets
deleted file mode 100644
index f6eb926e3..000000000
--- a/LibGit2Sharp/UniqueIdentifier.targets
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
- .
- $(MSBuildThisFileDirectory)
- $(LibGit2SharpPath)\Core\UniqueIdentifier.cs
- $(CoreCompileDependsOn);GenerateUniqueIdentifierCs
- $(CoreCleanDependsOn);CleanUniqueIdentifierCs
-
-
-
-
-
-
-
-
-
-
-
diff --git a/LibGit2Sharp/UnmatchedPathException.cs b/LibGit2Sharp/UnmatchedPathException.cs
index 7d118346d..f433eec13 100644
--- a/LibGit2Sharp/UnmatchedPathException.cs
+++ b/LibGit2Sharp/UnmatchedPathException.cs
@@ -1,12 +1,16 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
namespace LibGit2Sharp
{
///
/// The exception that is thrown when an explicit path or a list of explicit paths could not be matched.
///
+#if DESKTOP
[Serializable]
+#endif
public class UnmatchedPathException : LibGit2SharpException
{
///
@@ -41,6 +45,7 @@ public UnmatchedPathException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -49,5 +54,6 @@ public UnmatchedPathException(string message, Exception innerException)
protected UnmatchedPathException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
}
}
diff --git a/LibGit2Sharp/UnmergedIndexEntriesException.cs b/LibGit2Sharp/UnmergedIndexEntriesException.cs
index 729882678..e27c1d8fc 100644
--- a/LibGit2Sharp/UnmergedIndexEntriesException.cs
+++ b/LibGit2Sharp/UnmergedIndexEntriesException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -8,7 +10,9 @@ namespace LibGit2Sharp
/// The exception that is thrown when an operation that requires a fully merged index
/// is performed against an index with unmerged entries
///
+#if DESKTOP
[Serializable]
+#endif
public class UnmergedIndexEntriesException : LibGit2SharpException
{
///
@@ -43,6 +47,7 @@ public UnmergedIndexEntriesException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -51,6 +56,7 @@ public UnmergedIndexEntriesException(string message, Exception innerException)
protected UnmergedIndexEntriesException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal UnmergedIndexEntriesException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/UserCanceledException.cs b/LibGit2Sharp/UserCanceledException.cs
index 41eebb29a..1d3e3fb11 100644
--- a/LibGit2Sharp/UserCanceledException.cs
+++ b/LibGit2Sharp/UserCanceledException.cs
@@ -1,5 +1,7 @@
using System;
+#if DESKTOP
using System.Runtime.Serialization;
+#endif
using LibGit2Sharp.Core;
namespace LibGit2Sharp
@@ -7,7 +9,9 @@ namespace LibGit2Sharp
///
/// The exception that is thrown when an operation is canceled.
///
+#if DESKTOP
[Serializable]
+#endif
public class UserCancelledException : LibGit2SharpException
{
///
@@ -42,6 +46,7 @@ public UserCancelledException(string message, Exception innerException)
: base(message, innerException)
{ }
+#if DESKTOP
///
/// Initializes a new instance of the class with a serialized data.
///
@@ -50,6 +55,7 @@ public UserCancelledException(string message, Exception innerException)
protected UserCancelledException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
+#endif
internal UserCancelledException(string message, GitErrorCode code, GitErrorCategory category)
: base(message, code, category)
diff --git a/LibGit2Sharp/Version.cs b/LibGit2Sharp/Version.cs
index b4cbd88f0..fb89d9bb2 100644
--- a/LibGit2Sharp/Version.cs
+++ b/LibGit2Sharp/Version.cs
@@ -11,7 +11,7 @@ namespace LibGit2Sharp
///
public class Version
{
- private readonly Assembly assembly = typeof(Repository).Assembly;
+ private readonly Assembly assembly = typeof(Repository).GetTypeInfo().Assembly;
///
/// Needed for mocking purposes.
@@ -27,17 +27,7 @@ internal static Version Build()
///
/// Returns version of the LibGit2Sharp library.
///
- public virtual string InformationalVersion
- {
- get
- {
- var attribute = (AssemblyInformationalVersionAttribute)assembly
- .GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false)
- .Single();
-
- return attribute.InformationalVersion;
- }
- }
+ public virtual string InformationalVersion => ThisAssembly.AssemblyInformationalVersion;
///
/// Returns all the optional features that were compiled into
@@ -90,10 +80,8 @@ private string RetrieveVersion()
string features = Features.ToString();
return string.Format(CultureInfo.InvariantCulture,
- "{0}-{1}-{2} ({3} - {4})",
+ "{0} ({1} - {2})",
InformationalVersion,
- LibGit2SharpCommitSha,
- LibGit2CommitSha,
Platform.ProcessorArchitecture,
features);
}
diff --git a/LibGit2Sharp/libgit2sharp_hash.txt b/LibGit2Sharp/libgit2sharp_hash.txt
deleted file mode 100644
index 354664565..000000000
--- a/LibGit2Sharp/libgit2sharp_hash.txt
+++ /dev/null
@@ -1 +0,0 @@
-unknown
diff --git a/LibGit2Sharp/packages.config b/LibGit2Sharp/packages.config
deleted file mode 100644
index 72b9ea358..000000000
--- a/LibGit2Sharp/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/appveyor.yml b/appveyor.yml
index 693cd95ee..31b98ac9f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,15 +1,18 @@
version: '{build}'
+os: Visual Studio 2017
+
branches:
only:
- master
- /^maint.*/
-skip_tags: true
+configuration: release
-image: Visual Studio 2015
+skip_tags: true
-clone_folder: C:\projects\libgit2sharp
+nuget:
+ disable_publish_on_pr: true
environment:
coveralls_token:
@@ -18,14 +21,10 @@ environment:
secure: nuzUT+HecXGIi3KaPd/1hgFEZJan/j6+oNbPV75JKjk=
coverity_email:
secure: eGVilNg1Yuq+Xj+SW8r3WCtjnzhoDV0sNJkma4NRq7A=
- version : 0.24.0
matrix:
- - xunit_runner: xunit.console.x86.exe
- Arch: 32
- publish_on_success: False
- - xunit_runner: xunit.console.exe
- Arch: 64
- publish_on_success: True
+ - publish_on_success: False
+ ExtraDefine: LEAKS_IDENTIFYING
+ - publish_on_success: True
matrix:
fast_finish: true
@@ -34,8 +33,6 @@ install:
- ps: |
Write-Host "Commit being built = " -NoNewLine
Write-Host $Env:APPVEYOR_REPO_COMMIT -ForegroundColor "Green"
- Write-Host "Current build version = " -NoNewLine
- Write-Host $Env:VERSION -ForegroundColor "Green"
Write-Host "Target branch = " -NoNewLine
Write-Host $Env:APPVEYOR_REPO_BRANCH -ForegroundColor "Green"
Write-Host "Is a Pull Request = " -NoNewLine
@@ -46,36 +43,20 @@ install:
Write-Host "Merge commit UTC timestamp = " -NoNewLine
Write-Host $BuildDate -ForegroundColor "Green"
- $VersionSuffix = ""
- If ($Env:APPVEYOR_REPO_BRANCH -ne "master")
- {
- $VersionSuffix = "-pre$BuildDate"
- }
- $Version = "$($Env:VERSION)$($VersionSuffix)"
- $Env:ASSEMBLY_INFORMATIONAL_VERSION = $Version
- Write-Host "Assembly informational version = " -NoNewLine
- Write-Host $Env:ASSEMBLY_INFORMATIONAL_VERSION -ForegroundColor "Green"
-
$Env:SHOULD_RUN_COVERITY_ANALYSIS = $($Env:APPVEYOR_SCHEDULED_BUILD -eq $True)
Write-Host "Should run Coverity analysis = " -NoNewLine
Write-Host $Env:SHOULD_RUN_COVERITY_ANALYSIS -ForegroundColor "Green"
- $Env:SHOULD_PACKAGE_NUGET_ARTIFACT = -not $Env:APPVEYOR_PULL_REQUEST_NUMBER -and -not $Env:APPVEYOR_SCHEDULED_BUILD
- Write-Host "Should package Nuget artifact = " -NoNewLine
- Write-Host $Env:SHOULD_PACKAGE_NUGET_ARTIFACT -ForegroundColor "Green"
-
$Env:SHOULD_RUN_COVERALLS = $($Env:APPVEYOR_SCHEDULED_BUILD -eq $True)
Write-Host "Should run Coveralls = " -NoNewLine
Write-Host $Env:SHOULD_RUN_COVERALLS -ForegroundColor "Green"
+ Write-Host "Identifying leaks = " -NoNewLine
+ Write-Host ($Env:ExtraDefine -eq "LEAKS_IDENTIFYING") -ForegroundColor "Green"
+
Write-Host "Should publish on success = " -NoNewLine
Write-Host $Env:publish_on_success -ForegroundColor "Green"
- If ($Env:SHOULD_PACKAGE_NUGET_ARTIFACT -eq $True)
- {
- cinst sourcelink -y
- }
-
If ($Env:SHOULD_RUN_COVERALLS -eq $True)
{
nuget install OpenCover -Version 4.6.166 -ExcludeVersion -OutputDirectory .\packages
@@ -87,66 +68,45 @@ install:
cinst curl -y
}
-assembly_info:
- patch: true
- file: LibGit2Sharp\Properties\AssemblyInfo.cs
- assembly_version: '$(VERSION)'
- assembly_file_version: '$(VERSION)'
- assembly_informational_version: '$(ASSEMBLY_INFORMATIONAL_VERSION)'
-
-cache:
- - packages
-
before_build:
-- ps: nuget restore "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.sln"
+- ps: |
+ msbuild "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.sln" `
+ /nologo /verbosity:quiet `
+ /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" `
+ /t:restore
build_script:
- ps: |
& cov-build.exe --dir cov-int msbuild "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.sln" `
- /verbosity:normal `
- /p:Configuration=Release `
+ /nologo /verbosity:minimal /fl /flp:verbosity=normal `
/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" `
- /property:ExtraDefine="LEAKS_IDENTIFYING"
+ /t:build,pack
test_script:
- ps: |
- If ($Env:SHOULD_RUN_COVERALLS -eq $True -and $Env:publish_on_success -eq $True)
- {
- .\packages\OpenCover\tools\OpenCover.Console.exe `
- -register:user `
- "-target:""$Env:APPVEYOR_BUILD_FOLDER\packages\xunit.runner.console.2.2.0\tools\$Env:xunit_runner""" `
- "-targetargs:""$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.Tests\bin\Release\LibGit2Sharp.Tests.dll"" -noshadow" `
- "-filter:+[LibGit2Sharp]* -[LibGit2Sharp.Tests]*" `
- -hideskipped:All `
- -output:opencoverCoverage.xml
- }
- ElseIf ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $False)
+ Foreach ($runner in 'xunit.console.exe','xunit.console.x86.exe')
{
- & "$Env:APPVEYOR_BUILD_FOLDER\packages\xunit.runner.console.2.2.0\tools\$Env:xunit_runner" `
- "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.Tests\bin\Release\LibGit2Sharp.Tests.dll" -noshadow
+ If ($Env:SHOULD_RUN_COVERALLS -eq $True -and $Env:publish_on_success -eq $True)
+ {
+ .\packages\OpenCover\tools\OpenCover.Console.exe `
+ -register:user `
+ "-target:""$Env:userprofile\.nuget\packages\xunit.runner.console\2.2.0\tools\$runner""" `
+ "-targetargs:""$Env:APPVEYOR_BUILD_FOLDER\bin\LibGit2Sharp.Tests\Release\net46\LibGit2Sharp.Tests.dll"" -noshadow" `
+ "-filter:+[LibGit2Sharp]* -[LibGit2Sharp.Tests]*" `
+ -hideskipped:All `
+ -output:opencoverCoverage.xml
+ }
+ ElseIf ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $False)
+ {
+ & "$Env:userprofile\.nuget\packages\xunit.runner.console\2.2.0\tools\$runner" `
+ "$Env:APPVEYOR_BUILD_FOLDER\bin\LibGit2Sharp.Tests\Release\net46\LibGit2Sharp.Tests.dll" -noshadow
+ }
}
+- dotnet test LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -f netcoreapp1.0 --no-build
+
after_test:
- ps: |
- If ($Env:SHOULD_PACKAGE_NUGET_ARTIFACT -eq $True -and $Env:publish_on_success -eq $True)
- {
- & "$Env:APPVEYOR_BUILD_FOLDER\nuget.package\BuildNugetPackage.ps1" `
- -commitSha "$Env:APPVEYOR_REPO_COMMIT" `
- -postBuild { sourcelink index `
- -pr LibGit2Sharp.csproj `
- -pp Configuration Release `
- -nf Core\NativeDllName.cs `
- -nf Core\UniqueIdentifier.cs `
- -nf Properties\AssemblyInfo.cs `
- -r .. `
- -u 'https://raw.githubusercontent.com/libgit2/libgit2sharp/{0}/%var2%' }
-
- Add-Type -Path "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp\bin\Release\LibGit2Sharp.dll"
- Write-Host "LibGit2Sharp version = $([LibGit2Sharp.GlobalSettings]::Version)" -ForegroundColor "Magenta"
-
- Get-ChildItem "$Env:APPVEYOR_BUILD_FOLDER\LibGit2sharp\*.nupkg" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- }
-
If ($Env:SHOULD_RUN_COVERALLS -eq $True -and $Env:publish_on_success -eq $True)
{
Write-Host "Uploading code coverage result..." -ForegroundColor "Green"
@@ -179,6 +139,16 @@ after_test:
cat .\curl-out.txt
}
+on_finish:
+- ps: Push-AppveyorArtifact "msbuild.log"
+
+on_success:
+- ps: |
+ if ($Env:publish_on_success -eq $True)
+ {
+ Get-ChildItem "bin\LibGit2Sharp\$env:configuration\*.nupkg" |% { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
+ }
+
notifications:
- provider: Email
to:
diff --git a/build.libgit2sharp.cmd b/build.libgit2sharp.cmd
deleted file mode 100644
index 6cd7d72cf..000000000
--- a/build.libgit2sharp.cmd
+++ /dev/null
@@ -1,35 +0,0 @@
-@ECHO OFF
-
-REM Sample usages:
-REM
-REM Building and running tests
-REM - build.libgit2sharp.cmd
-REM
-REM Building, running tests and embedding the libgit2sharp commit sha
-REM - build.libgit2sharp.cmd "6a6eb81272876fd63555165beef44de2aaa78a14"
-REM
-REM Building and identifying potential leaks while running tests
-REM - build.libgit2sharp.cmd "unknown" "LEAKS_IDENTIFYING"
-
-
-SETLOCAL
-
-SET BASEDIR=%~dp0
-SET FrameworkVersion=v4.0.30319
-SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework
-
-if exist "%SystemRoot%\Microsoft.NET\Framework64" (
- SET FrameworkDir=%SystemRoot%\Microsoft.NET\Framework64
-)
-
-ECHO ON
-
-SET CommitSha=%~1
-SET ExtraDefine=%~2
-
-"%BASEDIR%Lib/NuGet/NuGet.exe" restore "%BASEDIR%LibGit2Sharp.sln"
-"%FrameworkDir%\%FrameworkVersion%\msbuild.exe" "%BASEDIR%CI\build.msbuild" /property:CommitSha=%CommitSha% /property:ExtraDefine="%ExtraDefine%"
-
-ENDLOCAL
-
-EXIT /B %ERRORLEVEL%
diff --git a/build.libgit2sharp.sh b/build.libgit2sharp.sh
deleted file mode 100755
index 52b30fad1..000000000
--- a/build.libgit2sharp.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-set -e
-
-EXTRADEFINE="$1"
-
-# Setting LD_LIBRARY_PATH to the current working directory is needed to run
-# the tests successfully in linux. Without this, mono can't find libgit when
-# the libgit2sharp assembly has been shadow copied. OS X includes the current
-# working directory in its library search path, so it works without this value.
-export LD_LIBRARY_PATH=.
-
-xbuild CI/build.msbuild /target:Deploy /property:ExtraDefine="$EXTRADEFINE"
-
-exit $?
diff --git a/buildandtest.cmd b/buildandtest.cmd
new file mode 100644
index 000000000..60c96d709
--- /dev/null
+++ b/buildandtest.cmd
@@ -0,0 +1,39 @@
+@ECHO OFF
+
+REM Sample usages:
+REM
+REM Building and running tests
+REM - buildandtest.cmd
+REM
+REM Building and identifying potential leaks while running tests
+REM - buildandtest.cmd "LEAKS_IDENTIFYING"
+
+SETLOCAL
+
+SET EXTRADEFINE=%~1
+
+where dotnet 1>nul 2>nul
+IF ERRORLEVEL 1 (
+ ECHO Cannot find dotnet.exe. Run from a VS2017 Developer Prompt.
+ EXIT /B 1
+)
+
+ECHO ON
+
+SET Configuration=Release
+
+:: Restore packages
+dotnet restore "%~dp0\"
+@IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
+
+:: Build
+dotnet build "%~dp0\" /v:minimal /nologo /property:ExtraDefine="%EXTRADEFINE%"
+@IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
+
+:: Run tests on Desktop and CoreCLR
+"%userprofile%\.nuget\packages\xunit.runner.console\2.2.0\tools\xunit.console.exe" "%~dp0bin\LibGit2Sharp.Tests\%Configuration%\net46\LibGit2Sharp.Tests.dll" -noshadow
+@IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
+dotnet test "%~dp0LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj" --no-build -f netcoreapp1.0
+@IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
+
+EXIT /B %ERRORLEVEL%
diff --git a/buildandtest.sh b/buildandtest.sh
new file mode 100755
index 000000000..f0221295e
--- /dev/null
+++ b/buildandtest.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+set -e
+
+EXTRADEFINE="$1"
+
+# Setting LD_LIBRARY_PATH to the current working directory is needed to run
+# the tests successfully in linux. Without this, mono can't find libgit when
+# the libgit2sharp assembly has been shadow copied. OS X includes the current
+# working directory in its library search path, so it works without this value.
+export LD_LIBRARY_PATH=.
+
+# Build release for the code generator and the product itself.
+export Configuration=release
+
+# On linux we don't pack because we can't build for net40.
+# We just build for CoreCLR and run tests for it.
+dotnet restore
+dotnet build LibGit2Sharp.Tests -f netcoreapp1.0 /property:ExtraDefine="$EXTRADEFINE" /fl /flp:verbosity=detailed
+dotnet test LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -f netcoreapp1.0 --no-build
+
+exit $?
diff --git a/LibGit2Sharp/libgit2sharp.snk b/libgit2sharp.snk
similarity index 100%
rename from LibGit2Sharp/libgit2sharp.snk
rename to libgit2sharp.snk
diff --git a/lkg/CodeGeneration.dll b/lkg/CodeGeneration.dll
new file mode 100644
index 000000000..6144f5556
Binary files /dev/null and b/lkg/CodeGeneration.dll differ
diff --git a/lkg/CodeGeneration.pdb b/lkg/CodeGeneration.pdb
new file mode 100644
index 000000000..61f7ca0d4
Binary files /dev/null and b/lkg/CodeGeneration.pdb differ
diff --git a/nuget.config b/nuget.config
new file mode 100644
index 000000000..82b40bac5
--- /dev/null
+++ b/nuget.config
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/nuget.package/BuildNugetPackage.ps1 b/nuget.package/BuildNugetPackage.ps1
deleted file mode 100644
index 77d9c9b88..000000000
--- a/nuget.package/BuildNugetPackage.ps1
+++ /dev/null
@@ -1,87 +0,0 @@
-<#
-.SYNOPSIS
- Generates the NuGet packages (including the symbols).
- A clean build is performed the packaging.
-.PARAMETER commitSha
- The LibGit2Sharp commit sha that contains the version of the source code being packaged.
-#>
-
-Param(
- [Parameter(Mandatory=$true)]
- [string]$commitSha,
- [scriptblock]$postBuild
-)
-
-$ErrorActionPreference = "Stop"
-Set-StrictMode -Version Latest
-
-function Run-Command([scriptblock]$Command) {
- $output = ""
-
- $exitCode = 0
- $global:lastexitcode = 0
-
- & $Command
-
- if ($LastExitCode -ne 0) {
- $exitCode = $LastExitCode
- } elseif (!$?) {
- $exitCode = 1
- } else {
- return
- }
-
- $error = "``$Command`` failed"
-
- if ($output) {
- Write-Host -ForegroundColor "Red" $output
- $error += ". See output above."
- }
-
- Throw $error
-}
-
-function Clean-OutputFolder($folder) {
-
- If (Test-Path $folder) {
- Write-Host -ForegroundColor "Green" "Dropping `"$folder`" folder..."
-
- Run-Command { & Remove-Item -Recurse -Force "$folder" }
-
- Write-Host "Done."
- }
-}
-
-#################
-
-$root = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
-$projectPath = Join-Path $root "..\LibGit2Sharp"
-$slnPath = Join-Path $projectPath "..\LibGit2Sharp.sln"
-
-Remove-Item (Join-Path $projectPath "*.nupkg")
-
-Clean-OutputFolder (Join-Path $projectPath "bin\")
-Clean-OutputFolder (Join-Path $projectPath "obj\")
-
-# The nuspec file needs to be next to the csproj, so copy it there during the pack operation
-Copy-Item (Join-Path $root "LibGit2Sharp.nuspec") $projectPath
-
-Push-Location $projectPath
-
-try {
- Set-Content -Encoding ASCII $(Join-Path $projectPath "libgit2sharp_hash.txt") $commitSha
- Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Restore "$slnPath" }
- Run-Command { & "MSBuild.exe" "$slnPath" "/verbosity:minimal" "/p:Configuration=Release" }
-
- If ($postBuild) {
- Write-Host -ForegroundColor "Green" "Run post build script..."
- Run-Command { & ($postBuild) }
- }
-
- Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack -Prop Configuration=Release }
-}
-finally {
- Pop-Location
- Remove-Item (Join-Path $projectPath "LibGit2Sharp.nuspec")
- Set-Content -Encoding ASCII $(Join-Path $projectPath "libgit2sharp_hash.txt") "unknown"
-}
diff --git a/nuget.package/LibGit2Sharp.nuspec b/nuget.package/LibGit2Sharp.nuspec
deleted file mode 100644
index 8d51c7581..000000000
--- a/nuget.package/LibGit2Sharp.nuspec
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- $id$
- $version$
- $author$
- LibGit2Sharp maintainers
- https://github.com/libgit2/libgit2sharp/raw/master/LICENSE.md
- https://github.com/libgit2/libgit2sharp/
- false
- $description$
- https://github.com/libgit2/libgit2sharp/blob/master/CHANGES.md#libgit2sharp-changes
- https://github.com/libgit2/libgit2sharp/raw/master/square-logo.png
- git libgit2
-
-
-
-
-
-
-
-
diff --git a/version.json b/version.json
new file mode 100644
index 000000000..c731f2ab6
--- /dev/null
+++ b/version.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
+ "version": "0.25",
+ "publicReleaseRefSpec": [
+ "^refs/heads/master$", // we release out of master
+ "^refs/heads/v\\d+(?:\\.\\d+)?$" // we also release out of vNN branches
+ ],
+ "cloudBuild": {
+ "buildNumber": {
+ "enabled": true
+ }
+ }
+}