Skip to content

Commit f398240

Browse files
authored
Merge pull request #3559 from NelsonVides/libgit2sharp24
Updated LibGit2Sharp to version v0.24.0 fixes #2497
2 parents e67b182 + 4b9f3fc commit f398240

File tree

9 files changed

+273
-27
lines changed

9 files changed

+273
-27
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,5 @@ $RECYCLE.BIN/
177177
*.xlsm
178178
Installers/
179179
*.xlsx
180+
181+
CodeGraphData/

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props" Condition="Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.185\build\LibGit2Sharp.NativeBinaries.props')" />
34
<Import Project="..\packages\Antlr4.4.3.0\build\Antlr4.props" Condition="Exists('..\packages\Antlr4.4.3.0\build\Antlr4.props')" />
45
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
56
<PropertyGroup>
@@ -12,7 +13,8 @@
1213
<AssemblyName>Rubberduck</AssemblyName>
1314
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1415
<FileAlignment>512</FileAlignment>
15-
<NuGetPackageImportStamp>480c0557</NuGetPackageImportStamp>
16+
<NuGetPackageImportStamp>
17+
</NuGetPackageImportStamp>
1618
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
1719
<RestorePackages>true</RestorePackages>
1820
</PropertyGroup>
@@ -256,9 +258,9 @@
256258
<Reference Include="Infralution.Localization.Wpf">
257259
<HintPath>..\libs\Infralution.Localization.Wpf.dll</HintPath>
258260
</Reference>
259-
<Reference Include="LibGit2Sharp, Version=0.22.0.0, Culture=neutral, processorArchitecture=MSIL">
261+
<Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
260262
<SpecificVersion>False</SpecificVersion>
261-
<HintPath>..\packages\LibGit2Sharp.0.22.0-pre20150516171636\lib\net40\LibGit2Sharp.dll</HintPath>
263+
<HintPath>..\packages\LibGit2Sharp.0.24.0\lib\net40\LibGit2Sharp.dll</HintPath>
262264
</Reference>
263265
<Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
264266
<HintPath>..\packages\System.Windows.Interactivity.WPF.2.0.20525\lib\net40\Microsoft.Expression.Interactions.dll</HintPath>
@@ -1485,6 +1487,7 @@
14851487
<Error Condition="!Exists('..\packages\Antlr4.4.3.0\build\Antlr4.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.3.0\build\Antlr4.props'))" />
14861488
<Error Condition="!Exists('..\packages\Antlr4.4.3.0\build\Antlr4.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Antlr4.4.3.0\build\Antlr4.targets'))" />
14871489
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
1490+
<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'))" />
14881491
</Target>
14891492
<Import Project="..\packages\Antlr4.4.3.0\build\Antlr4.targets" Condition="Exists('..\packages\Antlr4.4.3.0\build\Antlr4.targets')" />
14901493
<PropertyGroup>

RetailCoder.VBE/packages.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<package id="Castle.Windsor" version="4.0.0" targetFramework="net45" />
88
<package id="EasyHook" version="2.7.6270" targetFramework="net45" />
99
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net45" />
10+
<package id="LibGit2Sharp" version="0.24.0" targetFramework="net45" />
11+
<package id="LibGit2Sharp.NativeBinaries" version="1.0.185" targetFramework="net45" />
1012
<package id="NLog" version="4.0.1" targetFramework="net45" />
1113
<package id="NLog.Schema" version="4.0.1" targetFramework="net45" />
1214
<package id="System.ValueTuple" version="4.4.0" targetFramework="net45" />

Rubberduck.SourceControl/GitProvider.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ public override IRepository InitVBAProject(string directory)
185185
var status = repo.RetrieveStatus(new StatusOptions {DetectRenamesInWorkDir = true});
186186
foreach (var stat in status.Untracked)
187187
{
188-
repo.Stage(stat.FilePath);
188+
LibGit2Sharp.Commands.Stage(repo, stat.FilePath);
189189
}
190190

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

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

252254
RequeryUnsyncedCommits();
@@ -270,7 +272,7 @@ public override void Pull()
270272
};
271273

272274
var signature = GetSignature();
273-
_repo.Network.Pull(signature, options);
275+
LibGit2Sharp.Commands.Pull(_repo, signature, options);
274276

275277
base.Pull();
276278

@@ -289,7 +291,7 @@ public override void Commit(string message)
289291
//The default behavior of LibGit2Sharp.Repo.Commit is to throw an exception if no signature is found,
290292
// but BuildSignature() does not throw if a signature is not found, it returns "unknown" instead.
291293
// so we pass a signature that won't throw along to the commit.
292-
_repo.Commit(message, GetSignature());
294+
_repo.Commit(message, author: GetSignature(), committer: GetSignature());
293295
}
294296
catch (LibGit2SharpException ex)
295297
{
@@ -301,7 +303,7 @@ public override void Stage(string filePath)
301303
{
302304
try
303305
{
304-
_repo.Stage(filePath);
306+
LibGit2Sharp.Commands.Stage(_repo, filePath);
305307
}
306308
catch (LibGit2SharpException ex)
307309
{
@@ -313,7 +315,7 @@ public override void Stage(IEnumerable<string> filePaths)
313315
{
314316
try
315317
{
316-
_repo.Stage(filePaths);
318+
LibGit2Sharp.Commands.Stage(_repo, filePaths);
317319
}
318320
catch (LibGit2SharpException ex)
319321
{
@@ -348,7 +350,7 @@ public override void Checkout(string branch)
348350
{
349351
try
350352
{
351-
_repo.Checkout(_repo.Branches[branch]);
353+
LibGit2Sharp.Commands.Checkout(_repo, branch);
352354
base.Checkout(branch);
353355

354356
RequeryUnsyncedCommits();
@@ -364,7 +366,7 @@ public override void CreateBranch(string branch)
364366
try
365367
{
366368
_repo.CreateBranch(branch);
367-
_repo.Checkout(branch);
369+
LibGit2Sharp.Commands.Checkout(_repo,branch);
368370

369371
RequeryUnsyncedCommits();
370372
}
@@ -379,7 +381,7 @@ public override void CreateBranch(string sourceBranch, string branch)
379381
try
380382
{
381383
_repo.CreateBranch(branch, _repo.Branches[sourceBranch].Commits.Last());
382-
_repo.Checkout(branch);
384+
LibGit2Sharp.Commands.Checkout(_repo, branch);
383385

384386
RequeryUnsyncedCommits();
385387
}
@@ -417,7 +419,7 @@ public override void Unpublish(string branch)
417419
{
418420
try
419421
{
420-
var remote = _repo.Branches[branch].Remote;
422+
var remote = _repo.Network.Remotes[branch];
421423

422424
_repo.Branches.Update(_repo.Branches[branch], b => b.Remote = remote.Name,
423425
b => b.TrackedBranch = null, b => b.UpstreamBranch = null);
@@ -462,8 +464,7 @@ public override void AddFile(string filePath)
462464
{
463465
try
464466
{
465-
// https://github.com/libgit2/libgit2sharp/wiki/Git-add
466-
_repo.Stage(filePath);
467+
LibGit2Sharp.Commands.Stage(_repo, filePath);
467468
}
468469
catch (LibGit2SharpException ex)
469470
{
@@ -481,7 +482,7 @@ public override void RemoveFile(string filePath, bool removeFromWorkingDirectory
481482
try
482483
{
483484
NotifyExternalFileChanges = false;
484-
_repo.Remove(filePath, removeFromWorkingDirectory);
485+
LibGit2Sharp.Commands.Remove(_repo, filePath, removeFromWorkingDirectory);
485486
NotifyExternalFileChanges = true;
486487
}
487488
catch (LibGit2SharpException ex)
@@ -554,7 +555,7 @@ public override void DeleteBranch(string branchName)
554555
};
555556
}
556557

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

560561
// remote local repo

Rubberduck.SourceControl/Rubberduck.SourceControl.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props" Condition="Exists('..\packages\LibGit2Sharp.0.22.0-pre20150516171636\build\net40\LibGit2Sharp.props')" />
43
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
54
<PropertyGroup>
65
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -38,9 +37,10 @@
3837
<LangVersion>7.1</LangVersion>
3938
</PropertyGroup>
4039
<ItemGroup>
41-
<Reference Include="LibGit2Sharp">
42-
<HintPath>..\packages\LibGit2Sharp.0.22.0-pre20150516171636\lib\net40\LibGit2Sharp.dll</HintPath>
43-
<Private>True</Private>
40+
<Reference Include="LibGit2Sharp, Version=0.24.0.0, Culture=neutral, PublicKeyToken=7cbde695407f0333, processorArchitecture=MSIL">
41+
<SpecificVersion>False</SpecificVersion>
42+
<private>True</private>
43+
<HintPath>..\packages\LibGit2Sharp.0.24.0\lib\net40\LibGit2Sharp.dll</HintPath>
4444
</Reference>
4545
<Reference Include="Microsoft.Vbe.Interop, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
4646
<SpecificVersion>False</SpecificVersion>
@@ -82,6 +82,7 @@
8282
</Compile>
8383
</ItemGroup>
8484
<ItemGroup>
85+
<None Include="_SourceControlClassDiagram.cd" />
8586
<None Include="packages.config" />
8687
</ItemGroup>
8788
<ItemGroup>
@@ -107,7 +108,6 @@
107108
<PropertyGroup>
108109
<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>
109110
</PropertyGroup>
110-
<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'))" />
111111
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
112112
</Target>
113113
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />

0 commit comments

Comments
 (0)