From 12550d6009e15cf8fadef5df476398d4a96067c6 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Mon, 31 Jul 2017 20:36:57 -0400 Subject: [PATCH 01/23] Remove CodeGeneration --- CodeGeneration/CodeGeneration.csproj | 12 - .../OfferFriendlyInteropOverloadsGenerator.cs | 312 ------------------ .../CodeGenerationAttributes.csproj | 12 - .../CustomMarshalerAttribute.cs | 21 -- .../OfferFriendlyInteropOverloadsAttribute.cs | 16 - LibGit2Sharp.sln | 18 +- LibGit2Sharp/CodeGenerator.targets | 135 +++----- LibGit2Sharp/LibGit2Sharp.csproj | 6 - lkg/CodeGeneration.dll | Bin 20992 -> 0 bytes lkg/CodeGeneration.pdb | Bin 3884 -> 0 bytes 10 files changed, 61 insertions(+), 471 deletions(-) delete mode 100644 CodeGeneration/CodeGeneration.csproj delete mode 100644 CodeGeneration/OfferFriendlyInteropOverloadsGenerator.cs delete mode 100644 CodeGenerationAttributes/CodeGenerationAttributes.csproj delete mode 100644 CodeGenerationAttributes/CustomMarshalerAttribute.cs delete mode 100644 CodeGenerationAttributes/OfferFriendlyInteropOverloadsAttribute.cs delete mode 100644 lkg/CodeGeneration.dll delete mode 100644 lkg/CodeGeneration.pdb diff --git a/CodeGeneration/CodeGeneration.csproj b/CodeGeneration/CodeGeneration.csproj deleted file mode 100644 index 4d9b0f60f..000000000 --- a/CodeGeneration/CodeGeneration.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - 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 deleted file mode 100644 index 77c6b4d28..000000000 --- a/CodeGeneration/OfferFriendlyInteropOverloadsGenerator.cs +++ /dev/null @@ -1,312 +0,0 @@ -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(TransformationContext context, IProgress progress, CancellationToken cancellationToken) - { - MemberDeclarationSyntax applyTo = context.ProcessingMember; - Compilation compilation = context.Compilation; - 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 deleted file mode 100644 index 4f81e364c..000000000 --- a/CodeGenerationAttributes/CodeGenerationAttributes.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - net40;netstandard1.0 - true - ..\libgit2sharp.snk - false - - - - - - \ No newline at end of file diff --git a/CodeGenerationAttributes/CustomMarshalerAttribute.cs b/CodeGenerationAttributes/CustomMarshalerAttribute.cs deleted file mode 100644 index 549dd1241..000000000 --- a/CodeGenerationAttributes/CustomMarshalerAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index 6aae514a3..000000000 --- a/CodeGenerationAttributes/OfferFriendlyInteropOverloadsAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -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/LibGit2Sharp.sln b/LibGit2Sharp.sln index 64945776b..8ca542f60 100644 --- a/LibGit2Sharp.sln +++ b/LibGit2Sharp.sln @@ -1,13 +1,10 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26407.1 +VisualStudioVersion = 15.0.26724.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibGit2Sharp", "LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenerationAttributes", "CodeGenerationAttributes\CodeGenerationAttributes.csproj", "{E1A8B99F-B2F6-4A38-9DF6-8792056D70FF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibGit2Sharp.Tests", "LibGit2Sharp.Tests\LibGit2Sharp.Tests.csproj", "{286E63EB-04DD-4ADE-88D6-041B57800761}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0CA739FD-DA4D-4F64-9834-DA14A3ECD04B}" ProjectSection(SolutionItems) = preProject @@ -17,8 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProjectSection EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -32,12 +27,11 @@ 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(ExtensibilityGlobals) = postSolution + SolutionGuid = {9BD5F77D-E47D-4621-9AA0-8598766902B9} + EndGlobalSection EndGlobal diff --git a/LibGit2Sharp/CodeGenerator.targets b/LibGit2Sharp/CodeGenerator.targets index 402001459..d55d50117 100644 --- a/LibGit2Sharp/CodeGenerator.targets +++ b/LibGit2Sharp/CodeGenerator.targets @@ -1,89 +1,64 @@ - - - - $(MSBuildProjectDirectory)\..\lkg\ - + - - - false - - - - - - $(CoreCompileDependsOn);GenerateNativeDllNameCs - GenerateCommitIdVersion;$(PrepareResourceNamesDependsOn) - $(IntermediateOutputPath)NativeDllName.cs - $(IntermediateOutputPath)UniqueIdentifier.cs - $(IntermediateOutputPath)libgit2sharp_hash.txt + $(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 - } -} - - - - - - - - + + + + + + + namespace LibGit2Sharp.Core + { + internal static class NativeDllName + { + public const string Name = "$(libgit2FileName)"%3b + } + } + + + + + + + + + + + + + - - - - + + + + - - - - + + - - + + + $(RootNamespace).libgit2sharp_hash.txt + + + - - - $(RootNamespace).libgit2sharp_hash.txt - - - diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index cf3d667c6..0c93c484c 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -27,16 +27,10 @@ Objects.tt - - - - - - diff --git a/lkg/CodeGeneration.dll b/lkg/CodeGeneration.dll deleted file mode 100644 index 2bd7491ea93440cff024e0bd18089d329e05e5ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20992 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 diff --git a/lkg/CodeGeneration.pdb b/lkg/CodeGeneration.pdb deleted file mode 100644 index 9e02155bf0e184d0e2677a2e04d05f0fbb5e6702..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3884 zcmb_feQ;D)6+h?h*V~YfB?(Isnhzia!pDXLC?5?3@&N=%ld=#BBI(QSOIW+vx4id~ zvRdVBNRxm}rBf6TTWM>dtux}NWvY%?XWEWq$B!AcI@Y07OJ}5=&Nwoo=n$kScu?QHaIu5WIk*IPA@~Ch4gs$NzYA0e{ZdC?U?&n+ z1OEtP8LTOB4e(EZ(+;i&z5(0k!Hg=5FLZw23!OPGJR4Z%&Gfj;x9U4^%^kST^?Nxs z*M-Z0>s|N-;JbmBI_t~4UEsnp2N$}q%;!ZeTngOa!qUFQE-Yb(vn$t9pkF|jpi@LYhNKt~Br2hAgAdUb@H6RQ zw561Uq>MfSUzyXXqD7F*q1=^6gOD>7LxPiz)t#4r%euLuo@Z&4ivJw?Qs(EUBrf zU1_&u#I*Eb#}v(QjU-Z5uVw7e%#oyZn|Kr+vE(8#eK?&+=6Sdf+t;V}t;M@igZfP; zb;UK2k{jIMDel_z%lwRq1Ry_Uuj{cF?9>3iA-IwdWbnx1aA8x1i^BaZUb>YbJH+#A= zS4gz4^9&`d!en9qT{F_mNPF~wPZzf%q+9Yy2KV|pw1JVK;*@5YmYRyIM!YGqs`7T7 zNS|iNct>Jpa36b>S(S?->&s93zjLMX%9ZZ9*KUMPdy2mDnKKQY^7aW=_~hdi!3!s% z{%FR8C#v#Yq+L%YwU`X68Ohm@h|O?@wkJ{tYaD*Z2;w-bMY>W5jGm5a#%Lm@nbWE} zwL@0OQQdjK(9}4xJA9`gvQsr5GH2bfl^wd7%%sBIiI}0A`k)1q;@T!0fsC0jtN*(= z(jJxGtN)*)k!U7msfXsXJ<0ZCY`?(vOKks|?W=76g|iB0YdE`#vr&)Q&@(uw8JnHc z>};}UR5Oyg8aJKT=my*!knXO`ezpAFuU{E{!y4Fk;_UZYOWxe^(duvh_K(upo2r9w zcCNfYWph@RGJfKDL8g0!5+K~sfg-QKi`ZF%Yjg=J8evZeR0IL2;bDqY$cwmuv>;~D z*}GXN_N(3v1!SM2)di?LWFdm-gZ9fp$p)!5EUP$_FOac)Stt==Z-!}&7gY@laJfdb zE<&vdO{P7Y_f$&Z(pu(4tnv7K9v|iLi~dJ-mVdwJN!;jS>IZxj?~OSAJ~D`x_?S8C z;cO32^zuX}Pn;AJ@9<{C zleCH|JfS>{FPw@K)3UtV3~~P)aBuYqWZ*M}dLo z$PX{+SOh+zKB1J00|HNKk6+eFa@WGF2~u@w%qL+9my>^Q?OwJoA?jfc1ey2RAByZY zS^dHBhq1_9p@gVGpol}czlYZNQNlF~jIKb;D1wTv41p`Az+%`@Mk`^Q58Ld|2Z|7= z5NU!|Q@^0fKo&-RiZUTu>9x zv9!J<;)F}|jYeBUxgXJ7sNli0vnZmcXQ0JGK}?;5!*n69{e3}g{+dEs7O<}tQycY` z;sNgx6!hE2ywok{M_~Y8dhF9extG=}vNUxPB|kzPLXo@5u-GpPmAe!yF`Z*u;p|+B zd9qbrT2F-qa07IEkxu2@&e>0L_AHMz@~H+s^&X#of=|E3&;6AA6PFl&lZ8B~^5ok* z)yK!)=O^AK@z@}V)7QnB<9y~lKKm9wc~P8ChPkW&*<$~O?GJfux0rmIPrW3<2-m*S z;7p3)-vCcapz2NIV9bG-vrCE?2MUL5z6{u0*}yJXPTp+Ox_rN)Dc`SJE|YZ5`W3RP zX=`jLzzhp8fjx$#q-q&=XUCXMDW;S^Q%9@hoDT`AqedKD+9+h2i_C1!R`J*d9=ps( ze0*d~WM8Ck) Date: Mon, 31 Jul 2017 20:37:34 -0400 Subject: [PATCH 02/23] Move to .NET Standard 2.0 --- LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj | 2 +- LibGit2Sharp/LibGit2Sharp.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index 4d8d204de..4dd73ef8c 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -1,6 +1,6 @@  - net46;netcoreapp1.0 + net46;netcoreapp2.0 true $(DefineConstants);DESKTOP false diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 0c93c484c..4919e1a8b 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -1,6 +1,6 @@  - net40;netstandard1.3 + net40;netstandard2.0 true LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono. LibGit2Sharp contributors From 8f07d9cdbafb6cf14d588d214df71d4fed90fbb4 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Tue, 1 Aug 2017 23:13:05 -0400 Subject: [PATCH 03/23] Use custom marshaling --- LibGit2Sharp/Core/EncodingMarshaler.cs | 8 - LibGit2Sharp/Core/FilePathMarshaler.cs | 17 +- LibGit2Sharp/Core/NativeMethods.cs | 630 ++++++++++++------------- LibGit2Sharp/Core/Utf8Marshaler.cs | 17 +- 4 files changed, 332 insertions(+), 340 deletions(-) diff --git a/LibGit2Sharp/Core/EncodingMarshaler.cs b/LibGit2Sharp/Core/EncodingMarshaler.cs index af10db780..0cafd9aa1 100644 --- a/LibGit2Sharp/Core/EncodingMarshaler.cs +++ b/LibGit2Sharp/Core/EncodingMarshaler.cs @@ -117,11 +117,7 @@ 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) @@ -136,11 +132,7 @@ 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 952c6de18..209254ac5 100644 --- a/LibGit2Sharp/Core/FilePathMarshaler.cs +++ b/LibGit2Sharp/Core/FilePathMarshaler.cs @@ -10,13 +10,15 @@ 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: CustomMarshaler(typeof(LaxFilePathNoCleanupMarshaler), typeof(FilePath))] + /// [return: MarshalAs(UnmanagedType.CustomMarshaler, + /// MarshalCookie = UniqueId.UniqueIdentifier, + /// MarshalTypeRef = typeof(LaxFilePathNoCleanupMarshaler))] /// internal class LaxFilePathNoCleanupMarshaler : LaxFilePathMarshaler { private static readonly LaxFilePathNoCleanupMarshaler staticInstance = new LaxFilePathNoCleanupMarshaler(); - public new static ICustomMarshaler GetInstance() + public new static ICustomMarshaler GetInstance(string cookie) { return staticInstance; } @@ -39,15 +41,16 @@ public override void CleanUpNativeData(IntPtr pNativeData) /// /// Use this marshaler for function parameters, for example: /// [DllImport(libgit2)] - /// private static extern unsafe int git_index_remove_bypath( - /// git_index* index, - /// [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path); + /// internal static extern int git_index_open(out IndexSafeHandle index, + /// [MarshalAs(UnmanagedType.CustomMarshaler, + /// MarshalCookie = UniqueId.UniqueIdentifier, + /// MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath indexpath); /// internal class StrictFilePathMarshaler : StrictUtf8Marshaler { private static readonly StrictFilePathMarshaler staticInstance = new StrictFilePathMarshaler(); - public new static ICustomMarshaler GetInstance() + public new static ICustomMarshaler GetInstance(string cookie) { return staticInstance; } @@ -95,7 +98,7 @@ internal class LaxFilePathMarshaler : LaxUtf8Marshaler { private static readonly LaxFilePathMarshaler staticInstance = new LaxFilePathMarshaler(); - public new static ICustomMarshaler GetInstance() + public new static ICustomMarshaler GetInstance(string cookie) { return staticInstance; } diff --git a/LibGit2Sharp/Core/NativeMethods.cs b/LibGit2Sharp/Core/NativeMethods.cs index b3e7f1297..d28a7aceb 100644 --- a/LibGit2Sharp/Core/NativeMethods.cs +++ b/LibGit2Sharp/Core/NativeMethods.cs @@ -2,18 +2,13 @@ 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; // ReSharper disable InconsistentNaming namespace LibGit2Sharp.Core { - [OfferFriendlyInteropOverloads] - internal static partial class NativeMethods + internal static class NativeMethods { public const uint GIT_PATH_MAX = 4096; private const string libgit2 = NativeDllName.Name; @@ -21,7 +16,7 @@ internal static partial class NativeMethods // An object tied to the lifecycle of the NativeMethods static class. // This will handle initialization and shutdown of the underlying // native library. - #pragma warning disable 0414 +#pragma warning disable 0414 private static readonly NativeShutdownObject shutdownObject; #pragma warning restore 0414 @@ -68,9 +63,9 @@ private sealed class NativeShutdownObject internal static extern unsafe GitError* giterr_last(); [DllImport(libgit2)] - private static unsafe extern void giterr_set_str( + internal static extern void giterr_set_str( GitErrorCategory error_class, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* errorString); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string errorString); [DllImport(libgit2)] internal static extern void giterr_set_oom(); @@ -83,43 +78,43 @@ private static unsafe extern void giterr_set_str( git_blame* blame, UInt32 index); [DllImport(libgit2)] - private static extern unsafe int git_blame_file( + internal static extern unsafe int git_blame_file( out git_blame* blame, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string path, git_blame_options options); [DllImport(libgit2)] internal static extern unsafe void git_blame_free(git_blame* blame); [DllImport(libgit2)] - private static extern unsafe int git_blob_create_fromdisk( + internal static extern unsafe int git_blob_create_fromdisk( ref GitOid id, git_repository* repo, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path); [DllImport(libgit2)] - private static extern unsafe int git_blob_create_fromworkdir( + internal static extern unsafe int git_blob_create_fromworkdir( ref GitOid id, git_repository* repo, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* relative_path); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath relative_path); [DllImport(libgit2)] - private static extern unsafe int git_blob_create_fromstream( + internal static extern unsafe int git_blob_create_fromstream( out IntPtr stream, git_repository* repositoryPtr, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* hintpath); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string hintpath); [DllImport(libgit2)] - internal static extern unsafe int git_blob_create_fromstream_commit( + internal static extern int git_blob_create_fromstream_commit( ref GitOid oid, IntPtr stream); [DllImport(libgit2)] - private static extern unsafe int git_blob_filtered_content( + internal static extern unsafe int git_blob_filtered_content( GitBuf buf, git_object* blob, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* as_path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string as_path, [MarshalAs(UnmanagedType.Bool)] bool check_for_binary_data); [DllImport(libgit2)] @@ -129,10 +124,10 @@ private static extern unsafe int git_blob_filtered_content( internal static extern unsafe Int64 git_blob_rawsize(git_object* blob); [DllImport(libgit2)] - private static extern unsafe int git_branch_create_from_annotated( + internal static extern unsafe int git_branch_create_from_annotated( out git_reference* ref_out, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* branch_name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string branch_name, git_annotated_commit* target, [MarshalAs(UnmanagedType.Bool)] bool force); @@ -156,10 +151,10 @@ internal static extern int git_branch_iterator_new( GitBranchType branch_type); [DllImport(libgit2)] - private static extern unsafe int git_branch_move( + internal static extern unsafe int git_branch_move( out git_reference* ref_out, git_reference* reference, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* new_branch_name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_branch_name, [MarshalAs(UnmanagedType.Bool)] bool force); [DllImport(libgit2)] @@ -169,10 +164,10 @@ internal static extern int git_branch_next( IntPtr iter); [DllImport(libgit2)] - private static extern unsafe int git_branch_remote_name( + internal static extern unsafe int git_branch_remote_name( GitBuf buf, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* canonical_branch_name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string canonical_branch_name); [DllImport(libgit2)] internal static extern unsafe int git_rebase_init( @@ -229,21 +224,21 @@ internal static extern unsafe int git_rebase_finish( internal static extern unsafe void git_rebase_free(git_rebase* rebase); [DllImport(libgit2)] - private static extern unsafe int git_remote_rename( + internal static extern unsafe int git_remote_rename( ref GitStrArray problems, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* old_name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* new_name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string old_name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_name); - private unsafe delegate int git_remote_rename_problem_cb( - [CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] byte* problematic_refspec, + internal delegate int git_remote_rename_problem_cb( + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] string problematic_refspec, IntPtr payload); [DllImport(libgit2)] - private static extern unsafe int git_branch_upstream_name( + internal static extern unsafe int git_branch_upstream_name( GitBuf buf, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* referenceName); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string referenceName); [DllImport(libgit2)] internal static extern void git_buf_free(GitBuf buf); @@ -261,10 +256,10 @@ internal static extern unsafe int git_checkout_index( ref GitCheckoutOpts opts); [DllImport(libgit2)] - private static extern unsafe int git_clone( + internal static extern unsafe int git_clone( out git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* origin_url, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* workdir_path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string origin_url, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath workdir_path, ref GitCloneOptions opts); [DllImport(libgit2)] @@ -274,49 +269,49 @@ private static extern unsafe int git_clone( internal static extern unsafe git_signature* git_commit_committer(git_object* commit); [DllImport(libgit2)] - private static extern unsafe int git_commit_create_from_ids( + internal static extern unsafe int git_commit_create_from_ids( out GitOid id, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* updateRef, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string updateRef, git_signature* author, git_signature* committer, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* encoding, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string encoding, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message, ref GitOid tree, UIntPtr parentCount, [MarshalAs(UnmanagedType.LPArray)] [In] IntPtr[] parents); [DllImport(libgit2)] - private static extern unsafe int git_commit_create_buffer( + internal static extern unsafe int git_commit_create_buffer( GitBuf res, git_repository* repo, git_signature* author, git_signature* committer, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* encoding, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string encoding, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message, git_object* tree, UIntPtr parent_count, IntPtr* parents /* git_commit** originally */); [DllImport(libgit2)] - private static extern unsafe int git_commit_create_with_signature( + internal static extern unsafe int git_commit_create_with_signature( out GitOid id, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* commit_content, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* signature, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* signature_field); + [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); - [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, 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_summary(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)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern unsafe string git_commit_message_encoding(git_object* commit); [DllImport(libgit2)] internal static extern unsafe git_oid* git_commit_parent_id(git_object* commit, uint n); @@ -328,26 +323,26 @@ private static extern unsafe int git_commit_create_with_signature( internal static extern unsafe git_oid* git_commit_tree_id(git_object* commit); [DllImport(libgit2)] - private static extern unsafe int git_commit_extract_signature( + internal static extern unsafe int git_commit_extract_signature( GitBuf signature, GitBuf signed_data, git_repository* repo, ref GitOid commit_id, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* field); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string field); [DllImport(libgit2)] - private static extern unsafe int git_config_delete_entry( + internal static extern unsafe int git_config_delete_entry( git_config* cfg, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] internal static extern unsafe int git_config_lock(out IntPtr txn, git_config* config); [DllImport(libgit2)] - private static extern unsafe int git_config_delete_multivar( + internal static extern unsafe int git_config_delete_multivar( git_config* cfg, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* regexp); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string regexp); [DllImport(libgit2)] internal static extern int git_config_find_global(GitBuf global_config_path); @@ -368,15 +363,15 @@ private static extern unsafe int git_config_delete_multivar( internal static extern unsafe void git_config_entry_free(GitConfigEntry* entry); [DllImport(libgit2)] - private static extern unsafe int git_config_get_entry( + internal static extern unsafe int git_config_get_entry( out GitConfigEntry* entry, git_config* cfg, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] - private static extern unsafe int git_config_add_file_ondisk( + internal static extern unsafe int git_config_add_file_ondisk( git_config* cfg, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path, uint level, [MarshalAs(UnmanagedType.Bool)] bool force); @@ -390,43 +385,43 @@ internal static extern unsafe int git_config_open_level( uint level); [DllImport(libgit2)] - private static unsafe extern int git_config_parse_bool( + internal static extern int git_config_parse_bool( [MarshalAs(UnmanagedType.Bool)] out bool value, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* valueToParse); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string valueToParse); [DllImport(libgit2)] - private static unsafe extern int git_config_parse_int32( + internal static extern int git_config_parse_int32( [MarshalAs(UnmanagedType.I4)] out int value, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* valueToParse); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string valueToParse); [DllImport(libgit2)] - private static unsafe extern int git_config_parse_int64( + internal static extern int git_config_parse_int64( [MarshalAs(UnmanagedType.I8)] out long value, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* valueToParse); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string valueToParse); [DllImport(libgit2)] - private static extern unsafe int git_config_set_bool( + internal static extern unsafe int git_config_set_bool( git_config* cfg, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, [MarshalAs(UnmanagedType.Bool)] bool value); [DllImport(libgit2)] - private static extern unsafe int git_config_set_int32( + internal static extern unsafe int git_config_set_int32( git_config* cfg, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, int value); [DllImport(libgit2)] - private static extern unsafe int git_config_set_int64( + internal static extern unsafe int git_config_set_int64( git_config* cfg, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, long value); [DllImport(libgit2)] - private static extern unsafe int git_config_set_string( + internal static extern unsafe int git_config_set_string( git_config* cfg, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* value); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string value); internal delegate int config_foreach_callback( IntPtr entry, @@ -439,10 +434,10 @@ internal static extern unsafe int git_config_foreach( IntPtr payload); [DllImport(libgit2)] - private static extern unsafe int git_config_iterator_glob_new( + internal static extern int git_config_iterator_glob_new( out IntPtr iter, IntPtr cfg, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* regexp); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string regexp); [DllImport(libgit2)] internal static extern int git_config_next( @@ -471,10 +466,10 @@ internal delegate int git_cred_acquire_cb( internal static extern int git_cred_default_new(out IntPtr cred); [DllImport(libgit2)] - private static unsafe extern int git_cred_userpass_plaintext_new( + internal static extern int git_cred_userpass_plaintext_new( out IntPtr cred, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* username, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* password); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string username, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string password); [DllImport(libgit2)] internal static extern void git_cred_free(IntPtr cred); @@ -554,11 +549,11 @@ internal unsafe delegate int git_diff_binary_cb( IntPtr payload); [DllImport(libgit2)] - private static extern unsafe int git_diff_blobs( + internal static extern unsafe int git_diff_blobs( git_object* oldBlob, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* old_as_path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string old_as_path, git_object* newBlob, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* new_as_path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string new_as_path, GitDiffOptions options, git_diff_file_cb fileCallback, git_diff_binary_cb binaryCallback, @@ -587,13 +582,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)] - private static unsafe extern int git_filter_register( - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + internal static extern int git_filter_register( + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, IntPtr gitFilter, int priority); [DllImport(libgit2)] - private static extern unsafe int git_filter_unregister( - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + internal static extern int git_filter_unregister( + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] internal static extern unsafe int git_filter_source_mode(git_filter_source* source); @@ -615,8 +610,8 @@ private static extern unsafe int git_filter_unregister( // git_libgit2_opts(GIT_OPT_SET_SEARCH_PATH, int level, const char *path) [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] - private static unsafe extern int git_libgit2_opts(int option, uint level, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* path); + internal static extern int git_libgit2_opts(int option, uint level, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string path); // git_libgit2_opts(GIT_OPT_ENABLE_*, int enabled) [DllImport(libgit2, CallingConvention = CallingConvention.Cdecl)] @@ -633,23 +628,23 @@ internal static extern unsafe int git_graph_descendant_of( ref GitOid ancestor); [DllImport(libgit2)] - private static extern unsafe int git_ignore_add_rule( + internal static extern unsafe int git_ignore_add_rule( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* rules); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string rules); [DllImport(libgit2)] internal static extern unsafe int git_ignore_clear_internal_rules(git_repository* repo); [DllImport(libgit2)] - private static extern unsafe int git_ignore_path_is_ignored( + internal static extern unsafe int git_ignore_path_is_ignored( out int ignored, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* path); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string path); [DllImport(libgit2)] - private static extern unsafe int git_index_add_bypath( + internal static extern unsafe int git_index_add_bypath( git_index* index, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path); [DllImport(libgit2)] internal static extern unsafe int git_index_add( @@ -657,12 +652,12 @@ internal static extern unsafe int git_index_add( git_index_entry* entry); [DllImport(libgit2)] - private static extern unsafe int git_index_conflict_get( + internal 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, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* path); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string path); [DllImport(libgit2)] internal static extern unsafe int git_index_conflict_iterator_new( @@ -693,9 +688,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)] - private static extern unsafe git_index_entry* git_index_get_bypath( + internal static extern unsafe git_index_entry* git_index_get_bypath( git_index* index, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string path, int stage); [DllImport(libgit2)] @@ -708,9 +703,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)] - private static extern unsafe int git_index_open( + internal static extern unsafe int git_index_open( out git_index* index, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* indexpath); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath indexpath); [DllImport(libgit2)] internal static extern unsafe int git_index_read( @@ -718,10 +713,9 @@ internal static extern unsafe int git_index_read( [MarshalAs(UnmanagedType.Bool)] bool force); [DllImport(libgit2)] - private static extern unsafe int git_index_remove_bypath( + internal static extern unsafe int git_index_remove_bypath( git_index* index, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* path); - + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string path); [DllImport(libgit2)] internal static extern unsafe UIntPtr git_index_reuc_entrycount(git_index* handle); @@ -730,9 +724,9 @@ private 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)] - private static extern unsafe git_index_reuc_entry* git_index_reuc_get_bypath( + internal static extern unsafe git_index_reuc_entry* git_index_reuc_get_bypath( git_index* handle, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* path); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string path); [DllImport(libgit2)] internal static extern unsafe int git_index_write(git_index* index); @@ -770,18 +764,18 @@ internal static extern unsafe int git_annotated_commit_from_ref( git_reference* reference); [DllImport(libgit2)] - private static extern unsafe int git_annotated_commit_from_fetchhead( + internal static extern unsafe int git_annotated_commit_from_fetchhead( out git_annotated_commit* annotatedCommit, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* branch_name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote_url, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string branch_name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote_url, ref GitOid oid); [DllImport(libgit2)] - private static extern unsafe int git_annotated_commit_from_revspec( + internal static extern unsafe int git_annotated_commit_from_revspec( out git_annotated_commit* annotatedCommit, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* revspec); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string revspec); [DllImport(libgit2)] internal static extern unsafe int git_annotated_commit_lookup( @@ -821,44 +815,44 @@ internal static extern unsafe int git_merge_analysis( internal static extern unsafe void git_annotated_commit_free(git_annotated_commit* commit); [DllImport(libgit2)] - private static unsafe extern int git_message_prettify( + internal static extern int git_message_prettify( GitBuf buf, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message, [MarshalAs(UnmanagedType.Bool)] bool strip_comments, sbyte comment_char); [DllImport(libgit2)] - private static extern unsafe int git_note_create( + internal static extern unsafe int git_note_create( out GitOid noteOid, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* notes_ref, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string notes_ref, git_signature* author, git_signature* committer, ref GitOid oid, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* note, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string note, int force); [DllImport(libgit2)] internal static extern unsafe void git_note_free(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)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern unsafe string git_note_message(git_note* note); [DllImport(libgit2)] internal static extern unsafe git_oid* git_note_id(git_note* note); [DllImport(libgit2)] - private static extern unsafe int git_note_read( + internal static extern unsafe int git_note_read( out git_note* note, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* notes_ref, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string notes_ref, ref GitOid oid); [DllImport(libgit2)] - private static extern unsafe int git_note_remove( + internal static extern unsafe int git_note_remove( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* notes_ref, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string notes_ref, git_signature* author, git_signature* committer, ref GitOid oid); @@ -874,9 +868,9 @@ internal delegate int git_note_foreach_cb( IntPtr payload); [DllImport(libgit2)] - private static extern unsafe int git_note_foreach( + internal static extern unsafe int git_note_foreach( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* notes_ref, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string notes_ref, git_note_foreach_cb cb, IntPtr payload); @@ -967,10 +961,10 @@ internal static extern unsafe int git_patch_line_stats( internal static extern unsafe void git_packbuilder_free(git_packbuilder* packbuilder); [DllImport(libgit2)] - private static extern unsafe int git_packbuilder_insert( + internal static extern unsafe int git_packbuilder_insert( git_packbuilder* packbuilder, ref GitOid id, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] internal static extern unsafe int git_packbuilder_insert_commit( @@ -978,10 +972,10 @@ internal static extern unsafe int git_packbuilder_insert_commit( ref GitOid id); [DllImport(libgit2)] - private static extern unsafe int git_packbuilder_insert_recur( + internal static extern unsafe int git_packbuilder_insert_recur( git_packbuilder* packbuilder, ref GitOid id, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] internal static extern unsafe int git_packbuilder_insert_tree( @@ -998,9 +992,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)] - private static extern unsafe int git_packbuilder_write( + internal static extern unsafe int git_packbuilder_write( git_packbuilder* packbuilder, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path, uint mode, IntPtr progressCallback, IntPtr payload); @@ -1009,31 +1003,31 @@ private static extern unsafe int git_packbuilder_write( internal static extern unsafe UIntPtr git_packbuilder_written(git_packbuilder* packbuilder); [DllImport(libgit2)] - private static extern unsafe int git_reference_create( + internal static extern unsafe int git_reference_create( out git_reference* reference, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, ref GitOid oid, [MarshalAs(UnmanagedType.Bool)] bool force, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message); [DllImport(libgit2)] - private static extern unsafe int git_reference_symbolic_create( + internal static extern unsafe int git_reference_symbolic_create( out git_reference* reference, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* target, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string target, [MarshalAs(UnmanagedType.Bool)] bool force, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message); internal delegate int ref_glob_callback( IntPtr reference_name, IntPtr payload); [DllImport(libgit2)] - private static extern unsafe int git_reference_foreach_glob( + internal static extern unsafe int git_reference_foreach_glob( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* glob, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string glob, ref_glob_callback callback, IntPtr payload); @@ -1041,72 +1035,72 @@ private static extern unsafe int git_reference_foreach_glob( internal static extern unsafe void git_reference_free(git_reference* reference); [DllImport(libgit2)] - private static unsafe extern int git_reference_is_valid_name( - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* refname); + internal static extern int git_reference_is_valid_name( + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string refname); [DllImport(libgit2)] internal static extern unsafe int git_reference_list(out GitStrArray array, git_repository* repo); [DllImport(libgit2)] - private static extern unsafe int git_reference_lookup( + internal static extern unsafe int git_reference_lookup( out git_reference* reference, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); - [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)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern unsafe string git_reference_name(git_reference* reference); [DllImport(libgit2)] - private static extern unsafe int git_reference_remove( + internal static extern unsafe int git_reference_remove( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] internal static extern unsafe git_oid* git_reference_target(git_reference* reference); [DllImport(libgit2)] - private static extern unsafe int git_reference_rename( + internal static extern unsafe int git_reference_rename( out git_reference* ref_out, git_reference* reference, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* newName, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string newName, [MarshalAs(UnmanagedType.Bool)] bool force, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message); [DllImport(libgit2)] - private static extern unsafe int git_reference_set_target( + internal static extern unsafe int git_reference_set_target( out git_reference* ref_out, git_reference* reference, ref GitOid id, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message); [DllImport(libgit2)] - private static extern unsafe int git_reference_symbolic_set_target( + internal static extern unsafe int git_reference_symbolic_set_target( out git_reference* ref_out, git_reference* reference, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* target, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string target, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message); - [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)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern unsafe string git_reference_symbolic_target(git_reference* reference); [DllImport(libgit2)] internal static extern unsafe GitReferenceType git_reference_type(git_reference* reference); [DllImport(libgit2)] - private static extern unsafe int git_reference_ensure_log( + internal static extern unsafe int git_reference_ensure_log( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* refname); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string refname); [DllImport(libgit2)] internal static extern unsafe void git_reflog_free(git_reflog* reflog); [DllImport(libgit2)] - private static extern unsafe int git_reflog_read( + internal static extern unsafe int git_reflog_read( out git_reflog* ref_out, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] internal static extern unsafe UIntPtr git_reflog_entrycount @@ -1129,53 +1123,53 @@ internal static extern unsafe UIntPtr git_reflog_entrycount internal static extern unsafe git_signature* git_reflog_entry_committer( 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)] + [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)] - private static unsafe extern int git_refspec_transform( + internal static extern int git_refspec_transform( GitBuf buf, IntPtr refspec, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] - private static unsafe extern int git_refspec_rtransform( + internal static extern int git_refspec_rtransform( GitBuf buf, IntPtr refspec, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); - [DllImport(libgit2, EntryPoint = "git_refspec_string")] - [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] - private static extern unsafe byte* git_refspec_string_( + [DllImport(libgit2)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern string git_refspec_string( IntPtr refSpec); [DllImport(libgit2)] - internal static extern unsafe RefSpecDirection git_refspec_direction(IntPtr refSpec); + internal static extern RefSpecDirection git_refspec_direction(IntPtr refSpec); - [DllImport(libgit2, EntryPoint = "git_refspec_dst")] - [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] - private static extern unsafe byte* git_refspec_dst_( + [DllImport(libgit2)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern string git_refspec_dst( IntPtr refSpec); - [DllImport(libgit2, EntryPoint = "git_refspec_src")] - [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] - private static extern unsafe byte* git_refspec_src_( + [DllImport(libgit2)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern string git_refspec_src( IntPtr refspec); [DllImport(libgit2)] internal static extern bool git_refspec_force(IntPtr refSpec); [DllImport(libgit2)] - private static extern unsafe bool git_refspec_src_matches( + internal static extern bool git_refspec_src_matches( IntPtr refspec, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* reference); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string reference); [DllImport(libgit2)] - private static extern unsafe bool git_refspec_dst_matches( + internal static extern bool git_refspec_dst_matches( IntPtr refspec, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* reference); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string reference); [DllImport(libgit2)] internal static extern unsafe int git_remote_autotag(git_remote* remote); @@ -1189,38 +1183,38 @@ internal static extern unsafe int git_remote_connect( ref GitStrArray custom_headers); [DllImport(libgit2)] - private static extern unsafe int git_remote_create( + internal static extern unsafe int git_remote_create( out git_remote* remote, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url); [DllImport(libgit2)] - private static extern unsafe int git_remote_create_anonymous( + internal static extern unsafe int git_remote_create_anonymous( out git_remote* remote, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url); [DllImport(libgit2)] - private static extern unsafe int git_remote_create_with_fetchspec( + internal static extern unsafe int git_remote_create_with_fetchspec( out git_remote* remote, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* refspec); + [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); [DllImport(libgit2)] - private static extern unsafe int git_remote_delete( + internal static extern unsafe int git_remote_delete( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] - private static extern unsafe int git_remote_fetch( + internal static extern unsafe int git_remote_fetch( git_remote* remote, ref GitStrArray refspecs, GitFetchOptions fetch_opts, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* log_message); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string log_message); [DllImport(libgit2)] internal static extern unsafe void git_remote_free(git_remote* remote); @@ -1244,61 +1238,61 @@ internal static extern unsafe int git_remote_push( internal static extern unsafe UIntPtr git_remote_refspec_count(git_remote* remote); [DllImport(libgit2)] - private static extern unsafe int git_remote_set_url( + internal static extern unsafe int git_remote_set_url( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url); [DllImport(libgit2)] - private static extern unsafe int git_remote_add_fetch( + internal static extern unsafe int git_remote_add_fetch( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url); [DllImport(libgit2)] - private static extern unsafe int git_remote_set_pushurl( + internal static extern unsafe int git_remote_set_pushurl( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url); [DllImport(libgit2)] - private static extern unsafe int git_remote_add_push( + internal static extern unsafe int git_remote_add_push( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url); [DllImport(libgit2)] - private static unsafe extern int git_remote_is_valid_name( - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* remote_name); + internal static extern int git_remote_is_valid_name( + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string remote_name); [DllImport(libgit2)] internal static extern unsafe int git_remote_list(out GitStrArray array, git_repository* repo); [DllImport(libgit2)] - private static extern unsafe int git_remote_lookup( + internal static extern unsafe int git_remote_lookup( out git_remote* remote, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] internal static extern unsafe int git_remote_ls(out git_remote_head** heads, out UIntPtr size, 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_name(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_url(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)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern unsafe string git_remote_pushurl(git_remote* remote); [DllImport(libgit2)] - private static extern unsafe void git_remote_set_autotag( + internal static extern unsafe void git_remote_set_autotag( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, TagFetchMode option); internal delegate int remote_progress_callback(IntPtr str, int len, IntPtr data); @@ -1323,11 +1317,11 @@ IntPtr data ); [DllImport(libgit2)] - private static unsafe extern int git_repository_discover( + internal static extern int git_repository_discover( GitBuf buf, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* start_path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath start_path, [MarshalAs(UnmanagedType.Bool)] bool across_fs, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* ceiling_dirs); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath ceiling_dirs); internal delegate int git_repository_fetchhead_foreach_cb( IntPtr remote_name, @@ -1346,24 +1340,24 @@ internal static extern unsafe int git_repository_fetchhead_foreach( internal static extern unsafe void git_repository_free(git_repository* repo); [DllImport(libgit2)] - internal static extern unsafe int git_repository_head_detached(IntPtr repo); + internal static extern int git_repository_head_detached(IntPtr repo); [DllImport(libgit2)] - internal static extern unsafe int git_repository_head_unborn(IntPtr repo); + internal static extern int git_repository_head_unborn(IntPtr repo); [DllImport(libgit2)] - private static extern unsafe int git_repository_ident( - [CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] out byte* name, - [CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] out byte* email, + 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, git_repository* repo); [DllImport(libgit2)] internal static extern unsafe int git_repository_index(out git_index* index, git_repository* repo); [DllImport(libgit2)] - private static extern unsafe int git_repository_init_ext( + internal static extern unsafe int git_repository_init_ext( out git_repository* repository, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path, GitRepositoryInitOptions options); [DllImport(libgit2)] @@ -1398,20 +1392,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)] - private static extern unsafe int git_repository_open( + internal static extern unsafe int git_repository_open( out git_repository* repository, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path); [DllImport(libgit2)] - private static extern unsafe int git_repository_open_ext( + internal static extern unsafe int git_repository_open_ext( out git_repository* repository, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* path, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath path, RepositoryOpenFlags flags, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* ceilingDirs); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath ceilingDirs); - [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)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxFilePathNoCleanupMarshaler))] + internal static extern unsafe FilePath git_repository_path(git_repository* repository); [DllImport(libgit2)] internal static extern unsafe void git_repository_set_config( @@ -1419,10 +1413,10 @@ internal static extern unsafe void git_repository_set_config( git_config* config); [DllImport(libgit2)] - private static extern unsafe int git_repository_set_ident( + internal static extern unsafe int git_repository_set_ident( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* email); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string email); [DllImport(libgit2)] @@ -1431,9 +1425,9 @@ internal static extern unsafe void git_repository_set_index( git_index* index); [DllImport(libgit2)] - private static extern unsafe int git_repository_set_workdir( + internal static extern unsafe int git_repository_set_workdir( git_repository* repository, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* workdir, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath workdir, [MarshalAs(UnmanagedType.Bool)] bool update_gitlink); [DllImport(libgit2)] @@ -1447,21 +1441,21 @@ internal static extern unsafe int git_repository_set_head_detached_from_annotate git_annotated_commit* commit); [DllImport(libgit2)] - private static extern unsafe int git_repository_set_head( + internal static extern unsafe int git_repository_set_head( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* refname); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string refname); [DllImport(libgit2)] internal static extern unsafe int git_repository_state( 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(git_repository* 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)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxFilePathNoCleanupMarshaler))] + internal static extern FilePath git_repository_workdir(IntPtr repository); [DllImport(libgit2)] internal static extern unsafe int git_reset( @@ -1486,11 +1480,11 @@ internal static extern unsafe int git_revert_commit( ref GitMergeOpts opts); [DllImport(libgit2)] - private static extern unsafe int git_revparse_ext( + internal static extern unsafe int git_revparse_ext( out git_object* obj, out git_reference* reference, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* spec); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string spec); [DllImport(libgit2)] internal static extern unsafe void git_revwalk_free(git_revwalk* walker); @@ -1520,28 +1514,28 @@ private static extern unsafe int git_revparse_ext( internal static extern unsafe void git_signature_free(git_signature* signature); [DllImport(libgit2)] - private static extern unsafe int git_signature_new( + internal static extern unsafe int git_signature_new( out git_signature* signature, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* email, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string email, long time, int offset); [DllImport(libgit2)] - private static extern unsafe int git_signature_now( + internal static extern unsafe int git_signature_now( out git_signature* signature, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* email); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string email); [DllImport(libgit2)] internal static extern unsafe int git_signature_dup(out git_signature* dest, git_signature* sig); [DllImport(libgit2)] - private static extern unsafe int git_stash_save( + internal static extern unsafe int git_stash_save( out GitOid id, git_repository* repo, git_signature* stasher, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message, StashModifiers flags); internal delegate int git_stash_cb( @@ -1572,10 +1566,10 @@ internal static extern unsafe int git_stash_pop( GitStashApplyOpts opts); [DllImport(libgit2)] - private static extern unsafe int git_status_file( + internal static extern unsafe int git_status_file( out FileStatus statusflags, git_repository* repo, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* filepath); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath filepath); [DllImport(libgit2)] @@ -1602,16 +1596,16 @@ internal static extern void git_strarray_free( ref GitStrArray array); [DllImport(libgit2)] - private static extern unsafe int git_submodule_lookup( + internal static extern unsafe int git_submodule_lookup( out git_submodule* reference, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name); [DllImport(libgit2)] - private static extern unsafe int git_submodule_resolve_url( + internal static extern unsafe int git_submodule_resolve_url( GitBuf buf, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* url); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string url); [DllImport(libgit2)] internal static extern unsafe int git_submodule_update( @@ -1638,14 +1632,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, EntryPoint = "git_submodule_path")] - [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] - private static extern unsafe byte* git_submodule_path_( + [DllImport(libgit2)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern unsafe string git_submodule_path( git_submodule* submodule); - [DllImport(libgit2, EntryPoint = "git_submodule_url")] - [return: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] - private static extern unsafe byte* git_submodule_url_( + [DllImport(libgit2)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern unsafe string git_submodule_url( git_submodule* submodule); [DllImport(libgit2)] @@ -1678,10 +1672,10 @@ internal static extern unsafe int git_submodule_reload( [MarshalAs(UnmanagedType.Bool)] bool force); [DllImport(libgit2)] - private static extern unsafe int git_submodule_status( + internal static extern unsafe int git_submodule_status( out SubmoduleStatus status, git_repository* repo, - [CustomMarshaler(typeof(StrictFilePathMarshaler), typeof(FilePath))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictFilePathMarshaler))] FilePath name, GitSubmoduleIgnore ignore); [DllImport(libgit2)] @@ -1690,49 +1684,49 @@ internal static extern unsafe int git_submodule_init( [MarshalAs(UnmanagedType.Bool)] bool overwrite); [DllImport(libgit2)] - private static extern unsafe int git_tag_annotation_create( + internal static extern unsafe int git_tag_annotation_create( out GitOid oid, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, git_object* target, git_signature* signature, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message); [DllImport(libgit2)] - private static extern unsafe int git_tag_create( + internal static extern unsafe int git_tag_create( out GitOid oid, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, git_object* target, git_signature* signature, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* message, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string message, [MarshalAs(UnmanagedType.Bool)] bool force); [DllImport(libgit2)] - private static extern unsafe int git_tag_create_lightweight( + internal static extern unsafe int git_tag_create_lightweight( out GitOid oid, git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string name, git_object* target, [MarshalAs(UnmanagedType.Bool)] bool force); [DllImport(libgit2)] - private static extern unsafe int git_tag_delete( + internal static extern unsafe int git_tag_delete( git_repository* repo, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* tagName); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string tagName); [DllImport(libgit2)] internal static extern unsafe int git_tag_list(out GitStrArray array, git_repository* repo); - [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_message(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)] + [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] + internal static extern unsafe string git_tag_name(git_object* tag); [DllImport(libgit2)] internal static extern unsafe git_signature* git_tag_tagger(git_object* tag); @@ -1764,8 +1758,8 @@ private 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)] - private static unsafe extern int git_transport_register( - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* prefix, + internal static extern int git_transport_register( + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string prefix, IntPtr transport_cb, IntPtr payload); @@ -1776,22 +1770,22 @@ internal static extern int git_transport_smart( IntPtr definition); [DllImport(libgit2)] - private static unsafe extern int git_transport_smart_certificate_check( + internal static extern int git_transport_smart_certificate_check( IntPtr transport, IntPtr cert, int valid, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* hostname); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string hostname); [DllImport(libgit2)] - private static unsafe extern int git_transport_smart_credentials( + internal static extern int git_transport_smart_credentials( out IntPtr cred_out, IntPtr transport, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* user, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string user, int methods); [DllImport(libgit2)] - private static unsafe extern int git_transport_unregister( - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* prefix); + internal static extern int git_transport_unregister( + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string prefix); [DllImport(libgit2)] internal static extern unsafe uint git_tree_entry_filemode(git_tree_entry* entry); @@ -1800,10 +1794,10 @@ private static unsafe extern int git_transport_unregister( internal static extern unsafe git_tree_entry* git_tree_entry_byindex(git_object* tree, UIntPtr idx); [DllImport(libgit2)] - private static extern unsafe int git_tree_entry_bypath( + internal static extern unsafe int git_tree_entry_bypath( out git_tree_entry* tree, git_object* root, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* treeentry_path); + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string treeentry_path); [DllImport(libgit2)] internal static extern unsafe void git_tree_entry_free(git_tree_entry* treeEntry); @@ -1811,9 +1805,9 @@ private 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, 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)] + [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)] internal static extern unsafe GitObjectType git_tree_entry_type(git_tree_entry* entry); @@ -1825,10 +1819,10 @@ private 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)] - private static extern unsafe int git_treebuilder_insert( + internal static extern unsafe int git_treebuilder_insert( IntPtr entry_out, git_treebuilder* builder, - [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* treeentry_name, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalCookie = UniqueId.UniqueIdentifier, MarshalTypeRef = typeof(StrictUtf8Marshaler))] string treeentry_name, ref GitOid id, uint attributes); diff --git a/LibGit2Sharp/Core/Utf8Marshaler.cs b/LibGit2Sharp/Core/Utf8Marshaler.cs index 53e14f4ec..a6fddb808 100644 --- a/LibGit2Sharp/Core/Utf8Marshaler.cs +++ b/LibGit2Sharp/Core/Utf8Marshaler.cs @@ -11,13 +11,15 @@ 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: CustomMarshaler(typeof(LaxUtf8NoCleanupMarshaler), typeof(string))] + /// [return: MarshalAs(UnmanagedType.CustomMarshaler, + /// MarshalCookie = UniqueId.UniqueIdentifier, + /// MarshalTypeRef = typeof(LaxUtf8NoCleanupMarshaler))] /// internal class LaxUtf8NoCleanupMarshaler : LaxUtf8Marshaler { private static readonly LaxUtf8NoCleanupMarshaler staticInstance = new LaxUtf8NoCleanupMarshaler(); - public new static ICustomMarshaler GetInstance() + public new static ICustomMarshaler GetInstance(string cookie) { return staticInstance; } @@ -39,9 +41,10 @@ public override void CleanUpNativeData(IntPtr pNativeData) /// /// Use this marshaler for function parameters, for example: /// [DllImport(libgit2)] - /// private static extern unsafe int git_tag_delete( - /// git_repository* repo, - /// [CustomMarshaler(typeof(StrictUtf8Marshaler), typeof(string))] byte* tagName); + /// internal static extern int git_tag_delete(RepositorySafeHandle repo, + /// [MarshalAs(UnmanagedType.CustomMarshaler + /// MarshalCookie = UniqueId.UniqueIdentifier, + /// MarshalTypeRef = typeof(StrictUtf8Marshaler))] String tagName); /// internal class StrictUtf8Marshaler : EncodingMarshaler { @@ -57,7 +60,7 @@ static StrictUtf8Marshaler() public StrictUtf8Marshaler() : base(encoding) { } - public static ICustomMarshaler GetInstance() + public static ICustomMarshaler GetInstance(string cookie) { return staticInstance; } @@ -93,7 +96,7 @@ internal class LaxUtf8Marshaler : EncodingMarshaler public LaxUtf8Marshaler() : base(Encoding) { } - public static ICustomMarshaler GetInstance() + public static ICustomMarshaler GetInstance(string cookie) { return staticInstance; } From 8a480bc1e95e7d07786f6b2903c198902c8f7765 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Tue, 1 Aug 2017 23:50:46 -0400 Subject: [PATCH 04/23] Remove unneeded conditional compilation --- .../AmbiguousSpecificationException.cs | 7 -- LibGit2Sharp/BareRepositoryException.cs | 6 -- LibGit2Sharp/BufferedStream.cs | 96 ------------------- LibGit2Sharp/CheckoutConflictException.cs | 6 -- LibGit2Sharp/Core/Handles/Libgit2Object.cs | 12 +-- LibGit2Sharp/Core/Proxy.cs | 7 +- LibGit2Sharp/EmptyCommitException.cs | 6 -- LibGit2Sharp/EntryExistsException.cs | 6 -- LibGit2Sharp/ICustomMarshaler.cs | 21 ---- LibGit2Sharp/InvalidSpecificationException.cs | 6 -- LibGit2Sharp/LibGit2SharpException.cs | 6 -- LibGit2Sharp/LockedFileException.cs | 6 -- .../MergeFetchHeadNotFoundException.cs | 6 -- LibGit2Sharp/NameConflictException.cs | 6 -- LibGit2Sharp/NonFastForwardException.cs | 6 -- LibGit2Sharp/NotFoundException.cs | 6 -- LibGit2Sharp/PeelException.cs | 6 -- LibGit2Sharp/PortableShims.cs | 19 ---- LibGit2Sharp/RecurseSubmodulesException.cs | 6 -- LibGit2Sharp/RemoveFromIndexException.cs | 6 -- LibGit2Sharp/RepositoryNotFoundException.cs | 6 -- .../SecureUsernamePasswordCredentials.cs | 4 - LibGit2Sharp/SmartSubtransportRegistration.cs | 2 +- LibGit2Sharp/UnbornBranchException.cs | 7 -- LibGit2Sharp/UnmatchedPathException.cs | 6 -- LibGit2Sharp/UnmergedIndexEntriesException.cs | 6 -- LibGit2Sharp/UserCanceledException.cs | 6 -- LibGit2Sharp/Version.cs | 2 +- 28 files changed, 4 insertions(+), 281 deletions(-) delete mode 100644 LibGit2Sharp/BufferedStream.cs delete mode 100644 LibGit2Sharp/ICustomMarshaler.cs delete mode 100644 LibGit2Sharp/PortableShims.cs diff --git a/LibGit2Sharp/AmbiguousSpecificationException.cs b/LibGit2Sharp/AmbiguousSpecificationException.cs index 0eece24ee..1d19bbfde 100644 --- a/LibGit2Sharp/AmbiguousSpecificationException.cs +++ b/LibGit2Sharp/AmbiguousSpecificationException.cs @@ -1,17 +1,12 @@ 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 { /// @@ -47,7 +42,6 @@ public AmbiguousSpecificationException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -56,6 +50,5 @@ 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 7954867f7..75ad9695c 100644 --- a/LibGit2Sharp/BareRepositoryException.cs +++ b/LibGit2Sharp/BareRepositoryException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -10,9 +8,7 @@ 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 { /// @@ -47,7 +43,6 @@ public BareRepositoryException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -56,7 +51,6 @@ 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 deleted file mode 100644 index 6b6a58052..000000000 --- a/LibGit2Sharp/BufferedStream.cs +++ /dev/null @@ -1,96 +0,0 @@ -#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/CheckoutConflictException.cs b/LibGit2Sharp/CheckoutConflictException.cs index 8480ccf60..a06360afb 100644 --- a/LibGit2Sharp/CheckoutConflictException.cs +++ b/LibGit2Sharp/CheckoutConflictException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -11,9 +9,7 @@ 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 { /// @@ -48,7 +44,6 @@ public CheckoutConflictException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -61,6 +56,5 @@ protected CheckoutConflictException(SerializationInfo info, StreamingContext con internal CheckoutConflictException(string message, GitErrorCode code, GitErrorCategory category) : base(message, code, category) { } -#endif } } diff --git a/LibGit2Sharp/Core/Handles/Libgit2Object.cs b/LibGit2Sharp/Core/Handles/Libgit2Object.cs index 5d5dc5459..8b255a3f0 100644 --- a/LibGit2Sharp/Core/Handles/Libgit2Object.cs +++ b/LibGit2Sharp/Core/Handles/Libgit2Object.cs @@ -106,18 +106,8 @@ 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/Proxy.cs b/LibGit2Sharp/Core/Proxy.cs index c46d5fc1e..02ae4a1c5 100644 --- a/LibGit2Sharp/Core/Proxy.cs +++ b/LibGit2Sharp/Core/Proxy.cs @@ -1603,12 +1603,7 @@ public static unsafe ObjectId git_odb_write(ObjectDatabaseHandle odb, byte[] dat int res; fixed(byte* p = data) { -#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()); + res = NativeMethods.git_odb_write(out id, odb, p, new UIntPtr((ulong)data.LongLength), type.ToGitObjectType()); } Ensure.ZeroResult(res); diff --git a/LibGit2Sharp/EmptyCommitException.cs b/LibGit2Sharp/EmptyCommitException.cs index b5e96a66b..8cd48e49f 100644 --- a/LibGit2Sharp/EmptyCommitException.cs +++ b/LibGit2Sharp/EmptyCommitException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif namespace LibGit2Sharp { @@ -9,9 +7,7 @@ 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 { /// @@ -46,7 +42,6 @@ public EmptyCommitException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -55,6 +50,5 @@ 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 d8a5208f9..2c46e4acd 100644 --- a/LibGit2Sharp/EntryExistsException.cs +++ b/LibGit2Sharp/EntryExistsException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -9,9 +7,7 @@ namespace LibGit2Sharp /// /// The exception that is thrown attempting to create a resource that already exists. /// -#if DESKTOP [Serializable] -#endif public class EntryExistsException : LibGit2SharpException { /// @@ -46,7 +42,6 @@ public EntryExistsException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -55,7 +50,6 @@ 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/ICustomMarshaler.cs b/LibGit2Sharp/ICustomMarshaler.cs deleted file mode 100644 index 29cfec215..000000000 --- a/LibGit2Sharp/ICustomMarshaler.cs +++ /dev/null @@ -1,21 +0,0 @@ -#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 f3374e9e2..64654852c 100644 --- a/LibGit2Sharp/InvalidSpecificationException.cs +++ b/LibGit2Sharp/InvalidSpecificationException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -12,9 +10,7 @@ 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 { /// @@ -49,7 +45,6 @@ public InvalidSpecificationException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -58,7 +53,6 @@ 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/LibGit2SharpException.cs b/LibGit2Sharp/LibGit2SharpException.cs index 1fcf1a3ae..e85dd638f 100644 --- a/LibGit2Sharp/LibGit2SharpException.cs +++ b/LibGit2Sharp/LibGit2SharpException.cs @@ -1,8 +1,6 @@ using System; using System.Globalization; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -10,9 +8,7 @@ namespace LibGit2Sharp /// /// The exception that is thrown when an error occurs during application execution. /// -#if DESKTOP [Serializable] -#endif public class LibGit2SharpException : Exception { /// @@ -48,7 +44,6 @@ public LibGit2SharpException(string format, params object[] args) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -57,7 +52,6 @@ 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 6a327b620..05859503a 100644 --- a/LibGit2Sharp/LockedFileException.cs +++ b/LibGit2Sharp/LockedFileException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -9,9 +7,7 @@ namespace LibGit2Sharp /// /// The exception that is thrown attempting to open a locked file. /// -#if DESKTOP [Serializable] -#endif public class LockedFileException : LibGit2SharpException { /// @@ -46,7 +42,6 @@ public LockedFileException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -55,7 +50,6 @@ 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 17393a38f..a86bf5caf 100644 --- a/LibGit2Sharp/MergeFetchHeadNotFoundException.cs +++ b/LibGit2Sharp/MergeFetchHeadNotFoundException.cs @@ -1,16 +1,12 @@ 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 { /// @@ -45,7 +41,6 @@ public MergeFetchHeadNotFoundException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -54,6 +49,5 @@ 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 88415c225..815415729 100644 --- a/LibGit2Sharp/NameConflictException.cs +++ b/LibGit2Sharp/NameConflictException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -9,9 +7,7 @@ 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 { /// @@ -46,7 +42,6 @@ public NameConflictException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -55,7 +50,6 @@ 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/NonFastForwardException.cs b/LibGit2Sharp/NonFastForwardException.cs index e01ef0bb4..487e8fd03 100644 --- a/LibGit2Sharp/NonFastForwardException.cs +++ b/LibGit2Sharp/NonFastForwardException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -10,9 +8,7 @@ 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 { /// @@ -47,7 +43,6 @@ public NonFastForwardException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -56,7 +51,6 @@ 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 82015a7f1..0e9b45bf3 100644 --- a/LibGit2Sharp/NotFoundException.cs +++ b/LibGit2Sharp/NotFoundException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -9,9 +7,7 @@ namespace LibGit2Sharp /// /// The exception that is thrown attempting to reference a resource that does not exist. /// -#if DESKTOP [Serializable] -#endif public class NotFoundException : LibGit2SharpException { /// @@ -46,7 +42,6 @@ public NotFoundException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -55,7 +50,6 @@ 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/PeelException.cs b/LibGit2Sharp/PeelException.cs index 21d81a4c4..09d6bdcc8 100644 --- a/LibGit2Sharp/PeelException.cs +++ b/LibGit2Sharp/PeelException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -10,9 +8,7 @@ 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 { /// @@ -47,7 +43,6 @@ public PeelException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -56,7 +51,6 @@ 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 deleted file mode 100644 index 220bbf642..000000000 --- a/LibGit2Sharp/PortableShims.cs +++ /dev/null @@ -1,19 +0,0 @@ -#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/RecurseSubmodulesException.cs b/LibGit2Sharp/RecurseSubmodulesException.cs index 3499519dd..cf4479701 100644 --- a/LibGit2Sharp/RecurseSubmodulesException.cs +++ b/LibGit2Sharp/RecurseSubmodulesException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif namespace LibGit2Sharp { @@ -10,9 +8,7 @@ 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 { /// @@ -38,7 +34,6 @@ public RecurseSubmodulesException(string message, Exception innerException, stri InitialRepositoryPath = initialRepositoryPath; } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -47,6 +42,5 @@ public RecurseSubmodulesException(string message, Exception innerException, stri protected RecurseSubmodulesException(SerializationInfo info, StreamingContext context) : base(info, context) { } -#endif } } diff --git a/LibGit2Sharp/RemoveFromIndexException.cs b/LibGit2Sharp/RemoveFromIndexException.cs index eca11eb3e..6d9718c18 100644 --- a/LibGit2Sharp/RemoveFromIndexException.cs +++ b/LibGit2Sharp/RemoveFromIndexException.cs @@ -1,17 +1,13 @@ 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 { /// @@ -47,7 +43,6 @@ public RemoveFromIndexException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -56,6 +51,5 @@ 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 10a0742f3..2255c0891 100644 --- a/LibGit2Sharp/RepositoryNotFoundException.cs +++ b/LibGit2Sharp/RepositoryNotFoundException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif namespace LibGit2Sharp { @@ -9,9 +7,7 @@ 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 { /// @@ -46,7 +42,6 @@ public RepositoryNotFoundException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -55,6 +50,5 @@ 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 09ed2310d..16427ddf3 100644 --- a/LibGit2Sharp/SecureUsernamePasswordCredentials.cs +++ b/LibGit2Sharp/SecureUsernamePasswordCredentials.cs @@ -26,11 +26,7 @@ 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 cc756885a..e9f21dada 100644 --- a/LibGit2Sharp/SmartSubtransportRegistration.cs +++ b/LibGit2Sharp/SmartSubtransportRegistration.cs @@ -40,7 +40,7 @@ private IntPtr CreateRegistrationPointer() var registration = new GitSmartSubtransportRegistration(); registration.SubtransportCallback = Marshal.GetFunctionPointerForDelegate(EntryPoints.SubtransportCallback); - registration.Rpc = typeof(RpcSmartSubtransport).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo()) ? (uint)1 : (uint)0; + registration.Rpc = typeof(RpcSmartSubtransport).IsAssignableFrom(typeof(T)) ? (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 ab4bccd52..34ef437cb 100644 --- a/LibGit2Sharp/UnbornBranchException.cs +++ b/LibGit2Sharp/UnbornBranchException.cs @@ -1,8 +1,5 @@ using System; -using System.Globalization; -#if DESKTOP using System.Runtime.Serialization; -#endif namespace LibGit2Sharp { @@ -10,9 +7,7 @@ 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 { /// @@ -47,7 +42,6 @@ public UnbornBranchException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -56,6 +50,5 @@ public UnbornBranchException(string message, Exception innerException) protected UnbornBranchException(SerializationInfo info, StreamingContext context) : base(info, context) { } -#endif } } diff --git a/LibGit2Sharp/UnmatchedPathException.cs b/LibGit2Sharp/UnmatchedPathException.cs index f433eec13..7d118346d 100644 --- a/LibGit2Sharp/UnmatchedPathException.cs +++ b/LibGit2Sharp/UnmatchedPathException.cs @@ -1,16 +1,12 @@ 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 { /// @@ -45,7 +41,6 @@ public UnmatchedPathException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -54,6 +49,5 @@ 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 e27c1d8fc..729882678 100644 --- a/LibGit2Sharp/UnmergedIndexEntriesException.cs +++ b/LibGit2Sharp/UnmergedIndexEntriesException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -10,9 +8,7 @@ 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 { /// @@ -47,7 +43,6 @@ public UnmergedIndexEntriesException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -56,7 +51,6 @@ 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 1d3e3fb11..41eebb29a 100644 --- a/LibGit2Sharp/UserCanceledException.cs +++ b/LibGit2Sharp/UserCanceledException.cs @@ -1,7 +1,5 @@ using System; -#if DESKTOP using System.Runtime.Serialization; -#endif using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -9,9 +7,7 @@ namespace LibGit2Sharp /// /// The exception that is thrown when an operation is canceled. /// -#if DESKTOP [Serializable] -#endif public class UserCancelledException : LibGit2SharpException { /// @@ -46,7 +42,6 @@ public UserCancelledException(string message, Exception innerException) : base(message, innerException) { } -#if DESKTOP /// /// Initializes a new instance of the class with a serialized data. /// @@ -55,7 +50,6 @@ 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 bc441adeb..077951113 100644 --- a/LibGit2Sharp/Version.cs +++ b/LibGit2Sharp/Version.cs @@ -11,7 +11,7 @@ namespace LibGit2Sharp /// public class Version { - private readonly Assembly assembly = typeof(Repository).GetTypeInfo().Assembly; + private readonly Assembly assembly = typeof(Repository).Assembly; /// /// Needed for mocking purposes. From ef1fa3a08b0c36d29ca0e427a4c97731663a4431 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Tue, 1 Aug 2017 23:55:41 -0400 Subject: [PATCH 05/23] Remove unused property --- Directory.Build.props | 2 -- 1 file changed, 2 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 0b47885d2..0ed6c6d38 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,8 +2,6 @@ $(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\ $(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\ - - 0.4.11 From 496fc2fc1789af1d09307c60b20d48c91e97cea0 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Tue, 1 Aug 2017 23:56:17 -0400 Subject: [PATCH 06/23] Add solution items --- LibGit2Sharp.sln | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LibGit2Sharp.sln b/LibGit2Sharp.sln index 8ca542f60..2563fba34 100644 --- a/LibGit2Sharp.sln +++ b/LibGit2Sharp.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26724.1 +VisualStudioVersion = 15.0.26730.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibGit2Sharp", "LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}" EndProject @@ -9,6 +9,8 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0CA739FD-DA4D-4F64-9834-DA14A3ECD04B}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore + Directory.Build.props = Directory.Build.props + Directory.Build.targets = Directory.Build.targets nuget.config = nuget.config version.json = version.json EndProjectSection From d73225f16c79c3df391a8873b67b95b3aff7fa5c Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Wed, 2 Aug 2017 00:05:23 -0400 Subject: [PATCH 07/23] Put ExtraDefine in Directory.Build.props --- Directory.Build.props | 3 +++ LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj | 1 - LibGit2Sharp/ExtraDefine.targets | 7 ------- LibGit2Sharp/LibGit2Sharp.csproj | 1 - 4 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 LibGit2Sharp/ExtraDefine.targets diff --git a/Directory.Build.props b/Directory.Build.props index 0ed6c6d38..c4e5543d3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,10 +1,13 @@ + $(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\ $(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\ + $(DefineConstants);$(ExtraDefine) + diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index 4dd73ef8c..f1c29e152 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -28,5 +28,4 @@ - \ No newline at end of file diff --git a/LibGit2Sharp/ExtraDefine.targets b/LibGit2Sharp/ExtraDefine.targets deleted file mode 100644 index b5ba508b5..000000000 --- a/LibGit2Sharp/ExtraDefine.targets +++ /dev/null @@ -1,7 +0,0 @@ - - - - - $(DefineConstants);$(ExtraDefine) - - diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 4919e1a8b..a0a810d6d 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -38,7 +38,6 @@ - https://github.com/libgit2/libgit2sharp/raw/$(GitCommitIdShort)/square-logo.png From 0a3306562f3616f42e4d42b5472fa1de40eb5973 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Wed, 2 Aug 2017 00:19:09 -0400 Subject: [PATCH 08/23] Cleanup --- .editorconfig | 3 +++ Directory.Build.targets | 2 ++ LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj | 16 +++++++--------- LibGit2Sharp/LibGit2Sharp.csproj | 14 +++++++++----- LibGit2Sharp/Properties/AssemblyInfo.cs | 3 --- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.editorconfig b/.editorconfig index 096ff2565..a9e981c1a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,6 @@ insert_final_newline = true [*.{sln,csroj}] trim_trailing_whitespace = false insert_final_newline = false + +[*.{props,targets}] +indent_size = 2 \ No newline at end of file diff --git a/Directory.Build.targets b/Directory.Build.targets index f7c1901a8..080355c7d 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,5 +1,7 @@ + true + diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index f1c29e152..1a1afffef 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -1,22 +1,22 @@  + net46;netcoreapp2.0 true $(DefineConstants);DESKTOP false + - - TestHelpers\Epoch.cs - - - TestHelpers\Platform.cs - + + + + @@ -25,7 +25,5 @@ - - - + \ No newline at end of file diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index a0a810d6d..f02eebb76 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -1,18 +1,20 @@  + net40;netstandard2.0 true LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono. LibGit2Sharp contributors + Copyright © LibGit2Sharp contributors libgit2 git https://github.com/libgit2/libgit2sharp/ LibGit2Sharp contributors - true ..\libgit2sharp.snk true $(DefineConstants);DESKTOP + @@ -22,22 +24,23 @@ - - - Objects.tt - + + + + + https://github.com/libgit2/libgit2sharp/raw/$(GitCommitIdShort)/square-logo.png @@ -45,4 +48,5 @@ https://github.com/libgit2/libgit2sharp/raw/$(GitCommitIdShort)/LICENSE.md + diff --git a/LibGit2Sharp/Properties/AssemblyInfo.cs b/LibGit2Sharp/Properties/AssemblyInfo.cs index ea5861dbd..ffa977d1d 100644 --- a/LibGit2Sharp/Properties/AssemblyInfo.cs +++ b/LibGit2Sharp/Properties/AssemblyInfo.cs @@ -1,13 +1,10 @@ using System; -using System.Reflection; using System.Runtime.InteropServices; // 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: AssemblyCopyright("Copyright © LibGit2Sharp contributors")] - [assembly: CLSCompliant(true)] // Setting ComVisible to false makes the types in this assembly not visible From 327472da494dabfdab7a6b582228d7416ea0fa03 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Wed, 2 Aug 2017 00:19:44 -0400 Subject: [PATCH 09/23] Remove unneeded package references --- LibGit2Sharp/LibGit2Sharp.csproj | 6 ------ 1 file changed, 6 deletions(-) diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index f02eebb76..6188310a8 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -33,12 +33,6 @@ - - - - - - From 23f4db405d4f5431c1d449ba6dce3ae1c7a86f70 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Wed, 2 Aug 2017 00:27:51 -0400 Subject: [PATCH 10/23] Include PDBs in package --- Directory.Build.targets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Directory.Build.targets b/Directory.Build.targets index 080355c7d..c1631f63d 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -2,6 +2,13 @@ true + $(TargetsForTfmSpecificContentInPackage);IncludePDBsInPackage + + + + + + From c99e54d57ec8848f5709de3d1eaff41402fbac72 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Wed, 2 Aug 2017 00:33:20 -0400 Subject: [PATCH 11/23] Move tests out of desktop folder --- LibGit2Sharp.Tests/MetaFixture.cs | 38 ++++++++++++++- .../{desktop => }/SmartSubtransportFixture.cs | 0 LibGit2Sharp.Tests/desktop/MetaFixture.cs | 46 ------------------- 3 files changed, 37 insertions(+), 47 deletions(-) rename LibGit2Sharp.Tests/{desktop => }/SmartSubtransportFixture.cs (100%) delete mode 100644 LibGit2Sharp.Tests/desktop/MetaFixture.cs diff --git a/LibGit2Sharp.Tests/MetaFixture.cs b/LibGit2Sharp.Tests/MetaFixture.cs index 64e232076..b70d9022c 100644 --- a/LibGit2Sharp.Tests/MetaFixture.cs +++ b/LibGit2Sharp.Tests/MetaFixture.cs @@ -13,13 +13,49 @@ namespace LibGit2Sharp.Tests { - public partial class MetaFixture + public class MetaFixture { private static readonly HashSet explicitOnlyInterfaces = new HashSet { typeof(IBelongToARepository), typeof(IDiffResult), }; + [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())); + } + [Fact] public void PublicTestMethodsAreFactsOrTheories() { diff --git a/LibGit2Sharp.Tests/desktop/SmartSubtransportFixture.cs b/LibGit2Sharp.Tests/SmartSubtransportFixture.cs similarity index 100% rename from LibGit2Sharp.Tests/desktop/SmartSubtransportFixture.cs rename to LibGit2Sharp.Tests/SmartSubtransportFixture.cs diff --git a/LibGit2Sharp.Tests/desktop/MetaFixture.cs b/LibGit2Sharp.Tests/desktop/MetaFixture.cs deleted file mode 100644 index 5103e19c6..000000000 --- a/LibGit2Sharp.Tests/desktop/MetaFixture.cs +++ /dev/null @@ -1,46 +0,0 @@ -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())); - } - } -} From 66aeba83f5d652d66f33d6678ace374d4116aebc Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Wed, 2 Aug 2017 01:10:20 -0400 Subject: [PATCH 12/23] Update code generation targets --- LibGit2Sharp/CodeGenerator.targets | 125 ++++++++++++++++------------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/LibGit2Sharp/CodeGenerator.targets b/LibGit2Sharp/CodeGenerator.targets index d55d50117..adb23c241 100644 --- a/LibGit2Sharp/CodeGenerator.targets +++ b/LibGit2Sharp/CodeGenerator.targets @@ -1,64 +1,75 @@  + - $(CoreCompileDependsOn);GenerateNativeDllNameCs - GenerateCommitIdVersion;$(PrepareResourceNamesDependsOn) - $(IntermediateOutputPath)NativeDllName.cs - $(IntermediateOutputPath)UniqueIdentifier.cs - $(IntermediateOutputPath)libgit2sharp_hash.txt + $(IntermediateOutputPath)NativeDllName.g.cs + $(IntermediateOutputPath)UniqueIdentifier.g.cs + - - - - - - - namespace LibGit2Sharp.Core - { - internal static class NativeDllName - { - public const string Name = "$(libgit2FileName)"%3b - } - } - - - - - - - - - - - - - - - - - - - - - - - - - $(RootNamespace).libgit2sharp_hash.txt - - - + + + + + + + + + +namespace LibGit2Sharp.Core +{ + internal static class NativeDllName + { + public const string Name = "$(libgit2FileName)"%3b + } +} + + + + + + + + + + + + + + + + + +namespace LibGit2Sharp.Core +{ + internal static class UniqueId + { + public const string UniqueIdentifier = "$([System.Guid]::NewGuid())"%3b + } +} + + + + + + + + + + + + + + + + + + + + + + + + From 1b6ad9a56af9c9d0faa840def8dd85cc8df347a1 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 5 Aug 2017 00:14:36 -0400 Subject: [PATCH 13/23] Update Version to not rely on embedded resources --- LibGit2Sharp/CodeGenerator.targets | 57 +++++++++++++++++++++++------- LibGit2Sharp/Version.cs | 30 +++------------- 2 files changed, 49 insertions(+), 38 deletions(-) diff --git a/LibGit2Sharp/CodeGenerator.targets b/LibGit2Sharp/CodeGenerator.targets index adb23c241..a4f0ad726 100644 --- a/LibGit2Sharp/CodeGenerator.targets +++ b/LibGit2Sharp/CodeGenerator.targets @@ -1,9 +1,14 @@  + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + $(IntermediateOutputPath)NativeDllName.g.cs $(IntermediateOutputPath)UniqueIdentifier.g.cs + $(IntermediateOutputPath)AssemblyCommitIds.g.cs @@ -16,13 +21,13 @@ -namespace LibGit2Sharp.Core -{ - internal static class NativeDllName - { + namespace LibGit2Sharp.Core + { + internal static class NativeDllName + { public const string Name = "$(libgit2FileName)"%3b - } -} + } + } @@ -40,13 +45,13 @@ namespace LibGit2Sharp.Core -namespace LibGit2Sharp.Core -{ - internal static class UniqueId - { + namespace LibGit2Sharp.Core + { + internal static class UniqueId + { public const string UniqueIdentifier = "$([System.Guid]::NewGuid())"%3b - } -} + } + } @@ -72,4 +77,32 @@ namespace LibGit2Sharp.Core + + + + + + + + + namespace LibGit2Sharp + { + internal static class AssemblyCommitIds + { + public const string LibGit2CommitSha = "$(libgit2hash)"%3b + public const string LibGit2SharpCommitSha = "$(GitCommitId)"%3b + } + } + + + + + + + + + + + + diff --git a/LibGit2Sharp/Version.cs b/LibGit2Sharp/Version.cs index 077951113..8b09a3ff5 100644 --- a/LibGit2Sharp/Version.cs +++ b/LibGit2Sharp/Version.cs @@ -1,7 +1,4 @@ using System.Globalization; -using System.IO; -using System.Linq; -using System.Reflection; using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -11,8 +8,6 @@ namespace LibGit2Sharp /// public class Version { - private readonly Assembly assembly = typeof(Repository).Assembly; - /// /// Needed for mocking purposes. /// @@ -42,23 +37,15 @@ public virtual BuiltInFeatures Features /// /// Returns the SHA hash for the libgit2 library. /// - public virtual string LibGit2CommitSha - { - get { return RetrieveAbbrevShaFrom("libgit2_hash.txt"); } - } + public virtual string LibGit2CommitSha => RetrieveAbbrevShaFrom(AssemblyCommitIds.LibGit2CommitSha); /// /// Returns the SHA hash for the LibGit2Sharp library. /// - public virtual string LibGit2SharpCommitSha - { - get { return RetrieveAbbrevShaFrom("libgit2sharp_hash.txt"); } - } + public virtual string LibGit2SharpCommitSha => RetrieveAbbrevShaFrom(AssemblyCommitIds.LibGit2SharpCommitSha); - private string RetrieveAbbrevShaFrom(string name) + private string RetrieveAbbrevShaFrom(string sha) { - string sha = ReadContentFromResource(assembly, name) ?? "unknown"; - var index = sha.Length > 7 ? 7 : sha.Length; return sha.Substring(0, index); } @@ -68,7 +55,7 @@ private string RetrieveAbbrevShaFrom(string name) /// /// /// The format of the version number is as follows: - /// Major.Minor.Patch-LibGit2Sharp_abbrev_hash-libgit2_abbrev_hash (x86|x64 - features) + /// Major.Minor.Patch+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features) /// /// public override string ToString() @@ -86,14 +73,5 @@ private string RetrieveVersion() Platform.ProcessorArchitecture, features); } - - private string ReadContentFromResource(Assembly assembly, string partialResourceName) - { - string name = string.Format(CultureInfo.InvariantCulture, "LibGit2Sharp.{0}", partialResourceName); - using (var sr = new StreamReader(assembly.GetManifestResourceStream(name))) - { - return sr.ReadLine(); - } - } } } From 4c4378882b34294e3259fb09d1406b1edb7c0c9a Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 5 Aug 2017 22:43:22 -0400 Subject: [PATCH 14/23] Use .NET Core 2.0 SDK on Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 25b98d6b8..e40e71914 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: csharp dist: trusty -dotnet: 1.0.1 +dotnet: 2.0.0 mono: none os: From e6b1efa510f2022b31b8e04ee61075648f3ac842 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 5 Aug 2017 22:51:16 -0400 Subject: [PATCH 15/23] Update Microsoft.NET.Test.Sdk --- LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj index 1a1afffef..e98f150ac 100644 --- a/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj +++ b/LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj @@ -23,7 +23,7 @@ - + - \ No newline at end of file + From 7b47408b673cff4257b018f909987974d731408a Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 5 Aug 2017 23:22:52 -0400 Subject: [PATCH 16/23] Fix build scripts --- appveyor.yml | 2 +- buildandtest.cmd | 2 +- buildandtest.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 31b98ac9f..e8dbeaab5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -103,7 +103,7 @@ test_script: } } -- dotnet test LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -f netcoreapp1.0 --no-build +- dotnet test LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -f netcoreapp2.0 --no-restore --no-build after_test: - ps: | diff --git a/buildandtest.cmd b/buildandtest.cmd index 60c96d709..b99f4d08e 100644 --- a/buildandtest.cmd +++ b/buildandtest.cmd @@ -33,7 +33,7 @@ dotnet build "%~dp0\" /v:minimal /nologo /property:ExtraDefine="%EXTRADEFINE%" :: 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 +dotnet test "%~dp0LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj" -f netcoreapp2.0 --no-restore --no-build @IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL% EXIT /B %ERRORLEVEL% diff --git a/buildandtest.sh b/buildandtest.sh index f0221295e..47e5e1053 100755 --- a/buildandtest.sh +++ b/buildandtest.sh @@ -15,7 +15,7 @@ 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 +dotnet build LibGit2Sharp.Tests -f netcoreapp2.0 /property:ExtraDefine="$EXTRADEFINE" /fl /flp:verbosity=detailed +dotnet test LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -f netcoreapp2.0 --no-restore --no-build exit $? From 4acc222f689cdf534203327596ba5e364da7c2e0 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sat, 5 Aug 2017 23:32:10 -0400 Subject: [PATCH 17/23] Run on macOS 10.12 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index e40e71914..975828182 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ language: csharp dist: trusty dotnet: 2.0.0 mono: none +osx_image: xcode8.3 os: - osx From 7b85110fe793db466effea9a77a39f7673660193 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sun, 6 Aug 2017 01:42:04 -0400 Subject: [PATCH 18/23] Add condition to fix design-time build --- LibGit2Sharp/CodeGenerator.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibGit2Sharp/CodeGenerator.targets b/LibGit2Sharp/CodeGenerator.targets index a4f0ad726..49a875110 100644 --- a/LibGit2Sharp/CodeGenerator.targets +++ b/LibGit2Sharp/CodeGenerator.targets @@ -77,7 +77,7 @@ - + From 53ef83bd26d93d7cc63194a7630c7b9e577c1dff Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sun, 6 Aug 2017 02:34:18 -0400 Subject: [PATCH 19/23] Update version test --- LibGit2Sharp.Tests/GlobalSettingsFixture.cs | 16 ++++++++-------- LibGit2Sharp/BuiltInFeatures.cs | 6 ++++++ LibGit2Sharp/Version.cs | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/LibGit2Sharp.Tests/GlobalSettingsFixture.cs b/LibGit2Sharp.Tests/GlobalSettingsFixture.cs index 365bc1a3e..d5dee6992 100644 --- a/LibGit2Sharp.Tests/GlobalSettingsFixture.cs +++ b/LibGit2Sharp.Tests/GlobalSettingsFixture.cs @@ -19,25 +19,25 @@ public void CanGetMinimumCompiledInFeatures() public void CanRetrieveValidVersionString() { // Version string format is: - // Major.Minor.Patch[-somePreleaseTag]-libgit2_abbrev_hash (x86|x64 - features) + // Major.Minor.Patch[-previewTag]+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features) // Example output: - // "0.17.0[-beta]+gdeadcafeee.LibGit2-06d772d (x86 - Threads, Https)" + // "0.25.0-preview.52+g871d13a67f.libgit2-15e1193 (x86 - Threads, Https)" string versionInfo = GlobalSettings.Version.ToString(); // The GlobalSettings.Version returned string should contain : - // 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+\.\d+\.\d+(-[\w\-\.]+)?\+(g(?[a-f0-9]{10})\.)?LibGit2-[a-f0-9]{7}) \((?\w+) - (?(?:\w*(?:, )*\w+)*)\)$"; + // version: '0.25.0[-previewTag]' LibGit2Sharp version number. + // git2SharpHash: '871d13a67f' LibGit2Sharp hash. + // arch: 'x86' or 'x64' libgit2 target. + // git2Features: 'Threads, Ssh' libgit2 features compiled with. + 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[-somePreleaseTag]+[gSomeGitCommit].LibGit2-abbrev_hash (x86|x64 - features). " + + "Major.Minor.Patch[-previewTag]+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features). " + "But found \"" + versionInfo + "\" instead."); } diff --git a/LibGit2Sharp/BuiltInFeatures.cs b/LibGit2Sharp/BuiltInFeatures.cs index db6a1a0ed..1cf0d92e9 100644 --- a/LibGit2Sharp/BuiltInFeatures.cs +++ b/LibGit2Sharp/BuiltInFeatures.cs @@ -29,5 +29,11 @@ public enum BuiltInFeatures /// libgit2. /// Ssh = (1 << 2), + + /// + /// Support for sub-second resolution in file modification times + /// is compiled into libgit2. + /// + NSec = (1 << 3), } } diff --git a/LibGit2Sharp/Version.cs b/LibGit2Sharp/Version.cs index 8b09a3ff5..747529e84 100644 --- a/LibGit2Sharp/Version.cs +++ b/LibGit2Sharp/Version.cs @@ -55,7 +55,7 @@ private string RetrieveAbbrevShaFrom(string sha) /// /// /// The format of the version number is as follows: - /// Major.Minor.Patch+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features) + /// Major.Minor.Patch[-previewTag]+g{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features) /// /// public override string ToString() From 2cce832b8f403492541e000a0fd1f7577a376c37 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Sun, 6 Aug 2017 02:41:49 -0400 Subject: [PATCH 20/23] Put SmartSubtransportFixture back in desktop-only folder --- LibGit2Sharp.Tests/{ => desktop}/SmartSubtransportFixture.cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename LibGit2Sharp.Tests/{ => desktop}/SmartSubtransportFixture.cs (100%) 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 From c0d8eafe4172447a621b59fce62db56acc5d5dd3 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Fri, 25 Aug 2017 19:12:27 -0400 Subject: [PATCH 21/23] Update to SourceLink 2.2.0 --- LibGit2Sharp.sln | 2 +- LibGit2Sharp/LibGit2Sharp.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LibGit2Sharp.sln b/LibGit2Sharp.sln index 2563fba34..fb8a7101b 100644 --- a/LibGit2Sharp.sln +++ b/LibGit2Sharp.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26730.0 +VisualStudioVersion = 15.0.26730.10 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibGit2Sharp", "LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}" EndProject diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 6188310a8..c49e90b9e 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -29,8 +29,8 @@ - - + + From 3ba098e94006fcb8b198a5f08a4537ebcda99f3b Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Fri, 25 Aug 2017 19:25:33 -0400 Subject: [PATCH 22/23] Add condition to avoid error during pack --- LibGit2Sharp/CodeGenerator.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LibGit2Sharp/CodeGenerator.targets b/LibGit2Sharp/CodeGenerator.targets index 49a875110..845f3cf03 100644 --- a/LibGit2Sharp/CodeGenerator.targets +++ b/LibGit2Sharp/CodeGenerator.targets @@ -65,7 +65,7 @@ - + From 5379d6a37fa3d93eccf2ef2b34e29863c718c551 Mon Sep 17 00:00:00 2001 From: Brandon Ording Date: Fri, 25 Aug 2017 19:58:52 -0400 Subject: [PATCH 23/23] Disable SourceLink on Travis CI --- LibGit2Sharp/LibGit2Sharp.csproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index c49e90b9e..0b37bf6af 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -15,6 +15,11 @@ $(DefineConstants);DESKTOP + + + false + +