Skip to content

Commit

Permalink
Merge pull request #3559 from NelsonVides/libgit2sharp24
Browse files Browse the repository at this point in the history
Updated LibGit2Sharp to version v0.24.0 fixes #2497
  • Loading branch information
Vogel612 committed Nov 25, 2017
2 parents e67b182 + 4b9f3fc commit f398240
Show file tree
Hide file tree
Showing 9 changed files with 273 additions and 27 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -177,3 +177,5 @@ $RECYCLE.BIN/
*.xlsm
Installers/
*.xlsx

CodeGraphData/
9 changes: 6 additions & 3 deletions RetailCoder.VBE/Rubberduck.csproj
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props')" />
<Import Project="..\packages\Antlr4.4.3.0\build\Antlr4.props" Condition="Exists('..\packages\Antlr4.4.3.0\build\Antlr4.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand All @@ -12,7 +13,8 @@
<AssemblyName>Rubberduck</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>480c0557</NuGetPackageImportStamp>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
Expand Down Expand Up @@ -256,9 +258,9 @@
<Reference Include="Infralution.Localization.Wpf">
<HintPath>..\libs\Infralution.Localization.Wpf.dll</HintPath>
</Reference>
<Reference Include="LibGit2Sharp, Version=0.22.0.0, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\LibGit2Sharp.0.22.0-pre20150516171636\lib\net40\LibGit2Sharp.dll</HintPath>
<HintPath>..\packages\LibGit2Sharp.0.24.0\lib\net40\LibGit2Sharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll</HintPath>
Expand Down Expand Up @@ -1485,6 +1487,7 @@
<Error Condition="!Exists('..\packages\Antlr4.4.3.0\build\Antlr4.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.3.0\build\Antlr4.props'))" />
<Error Condition="!Exists('..\packages\Antlr4.4.3.0\build\Antlr4.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.3.0\build\Antlr4.targets'))" />
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props'))" />
</Target>
<Import Project="..\packages\Antlr4.4.3.0\build\Antlr4.targets" Condition="Exists('..\packages\Antlr4.4.3.0\build\Antlr4.targets')" />
<PropertyGroup>
Expand Down
2 changes: 2 additions & 0 deletions RetailCoder.VBE/packages.config
Expand Up @@ -7,6 +7,8 @@
<package id="Castle.Windsor" version="4.0.0" targetFramework="net45" />
<package id="EasyHook" version="2.7.6270" targetFramework="net45" />
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net45" />
<package id="LibGit2Sharp" version="0.24.0" targetFramework="net45" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.185" targetFramework="net45" />
<package id="NLog" version="4.0.1" targetFramework="net45" />
<package id="NLog.Schema" version="4.0.1" targetFramework="net45" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net45" />
Expand Down
31 changes: 16 additions & 15 deletions Rubberduck.SourceControl/GitProvider.cs
Expand Up @@ -185,15 +185,15 @@ public override IRepository InitVBAProject(string directory)
var status = repo.RetrieveStatus(new StatusOptions {DetectRenamesInWorkDir = true});
foreach (var stat in status.Untracked)
{
repo.Stage(stat.FilePath);
LibGit2Sharp.Commands.Stage(repo, stat.FilePath);
}

try
{
//The default behavior of LibGit2Sharp.Repo.Commit is to throw an exception if no signature is found,
// but BuildSignature() does not throw if a signature is not found, it returns "unknown" instead.
// so we pass a signature that won't throw along to the commit.
repo.Commit("Initial Commit", GetSignature(repo));
repo.Commit("Initial Commit", author: GetSignature(repo), committer: GetSignature(repo));
}
catch(LibGit2SharpException ex)
{
Expand Down Expand Up @@ -246,7 +246,9 @@ public override void Fetch([Optional] string remoteName)

if (remote != null)
{
_repo.Network.Fetch(remote);
// FIXME: hardcoded string
IEnumerable<string> refSpec = new List<string>() {"+refs/heads/*:refs/remotes/origin/*"};
LibGit2Sharp.Commands.Fetch(_repo, remoteName, refSpec, null,"");
}

RequeryUnsyncedCommits();
Expand All @@ -270,7 +272,7 @@ public override void Pull()
};

var signature = GetSignature();
_repo.Network.Pull(signature, options);
LibGit2Sharp.Commands.Pull(_repo, signature, options);

base.Pull();

Expand All @@ -289,7 +291,7 @@ public override void Commit(string message)
//The default behavior of LibGit2Sharp.Repo.Commit is to throw an exception if no signature is found,
// but BuildSignature() does not throw if a signature is not found, it returns "unknown" instead.
// so we pass a signature that won't throw along to the commit.
_repo.Commit(message, GetSignature());
_repo.Commit(message, author: GetSignature(), committer: GetSignature());
}
catch (LibGit2SharpException ex)
{
Expand All @@ -301,7 +303,7 @@ public override void Stage(string filePath)
{
try
{
_repo.Stage(filePath);
LibGit2Sharp.Commands.Stage(_repo, filePath);
}
catch (LibGit2SharpException ex)
{
Expand All @@ -313,7 +315,7 @@ public override void Stage(IEnumerable<string> filePaths)
{
try
{
_repo.Stage(filePaths);
LibGit2Sharp.Commands.Stage(_repo, filePaths);
}
catch (LibGit2SharpException ex)
{
Expand Down Expand Up @@ -348,7 +350,7 @@ public override void Checkout(string branch)
{
try
{
_repo.Checkout(_repo.Branches[branch]);
LibGit2Sharp.Commands.Checkout(_repo, branch);
base.Checkout(branch);

RequeryUnsyncedCommits();
Expand All @@ -364,7 +366,7 @@ public override void CreateBranch(string branch)
try
{
_repo.CreateBranch(branch);
_repo.Checkout(branch);
LibGit2Sharp.Commands.Checkout(_repo,branch);

RequeryUnsyncedCommits();
}
Expand All @@ -379,7 +381,7 @@ public override void CreateBranch(string sourceBranch, string branch)
try
{
_repo.CreateBranch(branch, _repo.Branches[sourceBranch].Commits.Last());
_repo.Checkout(branch);
LibGit2Sharp.Commands.Checkout(_repo, branch);

RequeryUnsyncedCommits();
}
Expand Down Expand Up @@ -417,7 +419,7 @@ public override void Unpublish(string branch)
{
try
{
var remote = _repo.Branches[branch].Remote;
var remote = _repo.Network.Remotes[branch];

_repo.Branches.Update(_repo.Branches[branch], b => b.Remote = remote.Name,
b => b.TrackedBranch = null, b => b.UpstreamBranch = null);
Expand Down Expand Up @@ -462,8 +464,7 @@ public override void AddFile(string filePath)
{
try
{
// https://github.com/libgit2/libgit2sharp/wiki/Git-add
_repo.Stage(filePath);
LibGit2Sharp.Commands.Stage(_repo, filePath);
}
catch (LibGit2SharpException ex)
{
Expand All @@ -481,7 +482,7 @@ public override void RemoveFile(string filePath, bool removeFromWorkingDirectory
try
{
NotifyExternalFileChanges = false;
_repo.Remove(filePath, removeFromWorkingDirectory);
LibGit2Sharp.Commands.Remove(_repo, filePath, removeFromWorkingDirectory);
NotifyExternalFileChanges = true;
}
catch (LibGit2SharpException ex)
Expand Down Expand Up @@ -554,7 +555,7 @@ public override void DeleteBranch(string branchName)
};
}

_repo.Network.Push(branch.Remote, ":" + _repo.Branches[branchName].UpstreamBranchCanonicalName, options);
_repo.Network.Push(_repo.Network.Remotes[branchName], ":" + _repo.Branches[branchName].UpstreamBranchCanonicalName, options);
}

// remote local repo
Expand Down
10 changes: 5 additions & 5 deletions Rubberduck.SourceControl/Rubberduck.SourceControl.csproj
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props" Condition="Exists('..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -38,9 +37,10 @@
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="LibGit2Sharp">
<HintPath>..\packages\LibGit2Sharp.0.22.0-pre20150516171636\lib\net40\LibGit2Sharp.dll</HintPath>
<Private>True</Private>
<Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<private>True</private>
<HintPath>..\packages\LibGit2Sharp.0.24.0\lib\net40\LibGit2Sharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Vbe.Interop, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -82,6 +82,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="_SourceControlClassDiagram.cd" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand All @@ -107,7 +108,6 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props'))" />
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
Expand Down

0 comments on commit f398240

Please sign in to comment.