Skip to content

Commit 0b009d8

Browse files
authored
Merge pull request #1 from libgit2/master
Bump to master
2 parents 34772bb + 8c32b61 commit 0b009d8

20 files changed

+166
-130
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ env:
1212
jobs:
1313
build:
1414
name: Build
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-22.04
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v2.3.4
18+
uses: actions/checkout@v3.5.0
1919
with:
2020
fetch-depth: 0
2121
- name: Install .NET SDK
22-
uses: actions/setup-dotnet@v1.8.1
22+
uses: actions/setup-dotnet@v3.0.3
2323
with:
24-
dotnet-version: 6.0.x
24+
dotnet-version: 7.0.x
2525
- name: Build
2626
run: dotnet build LibGit2Sharp.sln --configuration Release
2727
- name: Upload packages
28-
uses: actions/upload-artifact@v2.2.4
28+
uses: actions/upload-artifact@v3.1.2
2929
with:
3030
name: NuGet packages
3131
path: bin/Packages/
@@ -36,63 +36,56 @@ jobs:
3636
strategy:
3737
matrix:
3838
arch: [ amd64 ]
39-
os: [windows-2019, macos-10.15]
40-
tfm: [ net472, netcoreapp3.1, net6.0 ]
39+
os: [ windows-2019, macos-11 ]
40+
tfm: [ net472, net6.0, net7.0 ]
4141
exclude:
42-
- os: macos-10.15
42+
- os: macos-11
4343
tfm: net472
4444
fail-fast: false
4545
steps:
4646
- name: Checkout
47-
uses: actions/checkout@v2.3.4
47+
uses: actions/checkout@v3.5.0
4848
with:
4949
fetch-depth: 0
5050
- name: Install .NET SDK
51-
uses: actions/setup-dotnet@v1.8.1
51+
uses: actions/setup-dotnet@v3.0.3
5252
with:
53-
dotnet-version: 6.0.x
54-
- name: Install .NET Core 3.1 runtime
55-
if: matrix.tfm == 'netcoreapp3.1'
56-
uses: actions/setup-dotnet@v1.8.1
57-
with:
58-
dotnet-version: 3.1.x
53+
dotnet-version: |
54+
7.0.x
55+
6.0.x
5956
- name: Run ${{ matrix.tfm }} tests
6057
run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
6158
test-linux:
6259
name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
63-
runs-on: ubuntu-20.04
60+
runs-on: ubuntu-22.04
6461
strategy:
6562
matrix:
6663
arch: [ amd64 ]
6764
# arch: [ amd64, arm64 ]
68-
distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04 ]
69-
sdk: [ '6.0', '3.1' ]
65+
distro: [ alpine.3.13, alpine.3.14, alpine.3.15, alpine.3.16, alpine.3.17, centos.7, centos.stream.8, debian.10, debian.11, fedora.36, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
66+
sdk: [ '6.0', '7.0' ]
7067
exclude:
71-
- arch: arm64
72-
distro: alpine.3.12
73-
- arch: arm64
74-
distro: alpine.3.13
75-
sdk: '3.1'
76-
- arch: arm64
77-
distro: alpine.3.14
78-
sdk: '3.1'
79-
- arch: arm64
80-
distro: centos.7
68+
- distro: alpine.3.13
69+
sdk: '7.0'
70+
- distro: alpine.3.14
71+
sdk: '7.0'
8172
include:
8273
- sdk: '6.0'
8374
tfm: net6.0
84-
- sdk: '3.1'
85-
tfm: netcoreapp3.1
75+
- sdk: '7.0'
76+
tfm: net7.0
8677
fail-fast: false
8778
steps:
8879
- name: Checkout
89-
uses: actions/checkout@v2.3.4
80+
uses: actions/checkout@v3.5.0
9081
with:
9182
fetch-depth: 0
9283
- name: Setup QEMU
9384
if: matrix.arch == 'arm64'
9485
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
9586
- name: Run ${{ matrix.tfm }} tests
9687
run: |
88+
git_command="git config --global --add safe.directory /app"
9789
test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING"
98-
docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$test_command"
90+
docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command"
91+

CHANGES.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,40 @@
11
# LibGit2Sharp Changes
22

3-
**LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono.**
4-
5-
- Source code: <https://github.com/libgit2/libgit2sharp>
6-
- NuGet package: <http://nuget.org/List/Packages/LibGit2Sharp>
7-
- Issue tracker: <https://github.com/libgit2/libgit2sharp/issues>
8-
- @libgit2sharp: <http://twitter.com/libgit2sharp>
9-
- CI servers:
10-
- Windows (x86/amd64): <https://ci.appveyor.com/project/libgit2/libgit2sharp>
11-
- Linux/Mac OS X: <https://travis-ci.org/libgit2/libgit2sharp>
3+
## v0.27.2 - ([diff](https://github.com/libgit2/libgit2sharp/compare/0.27.1..0.27.2))
4+
5+
### Changes
6+
- This release includes [libgit2 v1.6.4](https://github.com/libgit2/libgit2/releases/tag/v1.6.4).
7+
8+
### Fixes
9+
- Can't access GIT config (Repository.Config) since v0.27.0 [#2031](https://github.com/libgit2/libgit2sharp/issues/2031)
10+
11+
## v0.27.1 - ([diff](https://github.com/libgit2/libgit2sharp/compare/0.27.0..0.27.1))
12+
13+
### Fixes
14+
- AssemblyVersion of v0.27.0 is `0.0.0.0`, which is lower than the AssemblyVersion of the v0.26.x releases. [#2030](https://github.com/libgit2/libgit2sharp/pull/2030)
15+
16+
## v0.27 - ([diff](https://github.com/libgit2/libgit2sharp/compare/v0.26..0.27.0))
17+
18+
### Changes
19+
- LibGit2Sharp now targets .NET Framework 4.7.2 and .NET 6.
20+
- This release includes [libgit2 v1.6.3](https://github.com/libgit2/libgit2/releases/tag/v1.6.3).
21+
- Changes to the native binaries let LibGit2Sharp work on all [.NET 6 supported OS versions and architectures](https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md).
22+
- `GlobalSetings.NativeLibraryPath` used to automatically append architecture to the path when running on .NET Framework. This behavior has been removed to make it consistent. [#1918](https://github.com/libgit2/libgit2sharp/pull/1918)
23+
24+
### Additions
25+
- Add support for adding and clearing multi-valued configuration [#1720](https://github.com/libgit2/libgit2sharp/pull/1720)
26+
- added lines and deleted lines in content changes [#1790](https://github.com/libgit2/libgit2sharp/pull/1790)
27+
- Set / get supported extensions [#1908](https://github.com/libgit2/libgit2sharp/pull/1908)
28+
- Simplify dealing with missing git objects [#1909](https://github.com/libgit2/libgit2sharp/pull/1909)
29+
- Throw NotFoundException if trees are missing when computing diff [#1936](https://github.com/libgit2/libgit2sharp/pull/1936)
30+
31+
### Fixes
32+
- Adjust GitStatusOptions to match structure of native libgit2 [#1884](https://github.com/libgit2/libgit2sharp/pull/1884)
33+
- Update git_worktree_add_options struct to include ref pointer [#1890](https://github.com/libgit2/libgit2sharp/pull/1890)
34+
- Fix git_remote_connect not throwing on non-zero result [#1913](https://github.com/libgit2/libgit2sharp/pull/1913)
35+
- Fix incorrect information in exceptions [#1919](https://github.com/libgit2/libgit2sharp/pull/1919)
36+
- Checkout branch looks to remote tracking branches as fallback [#1820](https://github.com/libgit2/libgit2sharp/pull/1820)
37+
- Fixed calling into native libgit2 on osx-arm64 [#1955](https://github.com/libgit2/libgit2sharp/pull/1955)
1238

1339
## v0.26 - ([diff](https://github.com/libgit2/libgit2sharp/compare/v0.25..v0.26))
1440

LibGit2Sharp.Tests/BlobFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void CanGetBlobAsFilteredText(string autocrlf, string expectedText)
4545
}
4646
}
4747

48-
#if NETFRAMEWORK || NETCOREAPP3_1 //UTF-7 is disabled in .NET 5+
48+
#if NETFRAMEWORK //UTF-7 is disabled in .NET 5+
4949
[Theory]
5050
[InlineData("ascii", 4, "31 32 33 34")]
5151
[InlineData("utf-7", 4, "31 32 33 34")]
@@ -239,11 +239,11 @@ public void CanTellIfABlobIsMissing()
239239
// Manually delete the objects directory to simulate a partial clone
240240
Directory.Delete(Path.Combine(repoPath, "objects", "a8"), true);
241241

242-
using (var repo = new Repository(repoPath))
242+
using (var repo = new Repository(repoPath))
243243
{
244244
// Look up for the tree that reference the blob which is now missing
245245
var tree = repo.Lookup<Tree>("fd093bff70906175335656e6ce6ae05783708765");
246-
var blob = (Blob) tree["README"].Target;
246+
var blob = (Blob)tree["README"].Target;
247247

248248
Assert.Equal("a8233120f6ad708f843d861ce2b7228ec4e3dec6", blob.Sha);
249249
Assert.NotNull(blob);

LibGit2Sharp.Tests/GlobalSettingsFixture.cs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ public void CanGetMinimumCompiledInFeatures()
2323
public void CanRetrieveValidVersionString()
2424
{
2525
// Version string format is:
26-
// Major.Minor.Patch[-previewTag]+{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features)
26+
// Major.Minor.Patch[-previewTag]+libgit2-{libgit2_abbrev_hash}.{LibGit2Sharp_hash} (arch - features)
2727
// Example output:
28-
// "0.25.0-preview.52+871d13a67f.libgit2-15e1193 (x86 - Threads, Https)"
28+
// "0.27.0-preview.0.1896+libgit2-c058aa8.c1ac3ed74487da5fac24cf1e48dc8ea71e917b75 (x64 - Threads, Https, NSec)"
2929

3030
string versionInfo = GlobalSettings.Version.ToString();
3131

3232
// The GlobalSettings.Version returned string should contain :
3333
// version: '0.25.0[-previewTag]' LibGit2Sharp version number.
34-
// git2SharpHash: '871d13a67f' LibGit2Sharp hash.
34+
// git2SharpHash: 'c1ac3ed74487da5fac24cf1e48dc8ea71e917b75' LibGit2Sharp hash.
3535
// arch: 'x86' or 'x64' libgit2 target.
3636
// git2Features: 'Threads, Ssh' libgit2 features compiled with.
37-
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?\+((?<git2SharpHash>[a-f0-9]{10})\.)?libgit2-[a-f0-9]{7}) \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
37+
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?)\+libgit2-[a-f0-9]{7}\.((?<git2SharpHash>[a-f0-9]{40}))? \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
3838

3939
Assert.NotNull(versionInfo);
4040

4141
Match regexResult = Regex.Match(versionInfo, regex);
4242

4343
Assert.True(regexResult.Success, "The following version string format is enforced:" +
44-
"Major.Minor.Patch[-previewTag]+{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features). " +
44+
"Major.Minor.Patch[-previewTag]+libgit2-{libgit2_abbrev_hash}.{LibGit2Sharp_hash} (arch - features). " +
4545
"But found \"" + versionInfo + "\" instead.");
4646
}
4747

@@ -90,22 +90,17 @@ public void SetExtensions()
9090
var extensions = GlobalSettings.GetExtensions();
9191

9292
// Assert that "noop" is supported by default
93-
Assert.Equal(new[] { "noop" }, extensions);
93+
Assert.Equal(new[] { "noop", "objectformat" }, extensions);
9494

9595
// Disable "noop" extensions
9696
GlobalSettings.SetExtensions("!noop");
9797
extensions = GlobalSettings.GetExtensions();
98-
Assert.Empty(extensions);
98+
Assert.Equal(new[] { "objectformat" }, extensions);
9999

100100
// Enable two new extensions (it will reset the configuration and "noop" will be enabled)
101101
GlobalSettings.SetExtensions("partialclone", "newext");
102102
extensions = GlobalSettings.GetExtensions();
103-
Assert.Equal(new[] { "noop", "partialclone", "newext" }, extensions);
104-
105-
// You can have multiple times the same extension
106-
GlobalSettings.SetExtensions("noop", "test", "test" );
107-
extensions = GlobalSettings.GetExtensions();
108-
Assert.Equal(new[] { "noop", "noop", "test", "test" }, extensions);
103+
Assert.Equal(new[] { "noop", "objectformat", "partialclone", "newext" }, extensions);
109104
}
110105
}
111106
}

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;netcoreapp3.1;net6.0</TargetFrameworks>
4+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;net6.0;net7.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -11,12 +11,12 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
16-
<PackageReference Include="Moq" Version="4.16.1" />
17-
<PackageReference Include="xunit" Version="2.4.1" />
18-
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
14+
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
16+
<PackageReference Include="Moq" Version="4.18.4" />
17+
<PackageReference Include="xunit" Version="2.4.2" />
18+
<PackageReference Include="xunit.runner.console" Version="2.4.2" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
2020
<PackageReference Include="xunit.skippablefact" Version="1.4.13" />
2121
</ItemGroup>
2222

LibGit2Sharp.sln

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Version 16
3-
VisualStudioVersion = 16.0.28803.202
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.5.33516.290
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibGit2Sharp", "LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}"
66
EndProject
@@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
Directory.Build.props = Directory.Build.props
1414
Targets\GenerateNativeDllName.targets = Targets\GenerateNativeDllName.targets
1515
nuget.config = nuget.config
16-
version.json = version.json
1716
EndProjectSection
1817
EndProject
1918
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NativeLibraryLoadTestApp.x86", "NativeLibraryLoadTestApp\x86\NativeLibraryLoadTestApp.x86.csproj", "{86453D2C-4953-4DF4-B12A-ADE579608BAA}"

LibGit2Sharp/Core/GitFetchOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ internal class GitFetchOptions
1111
public bool UpdateFetchHead = true;
1212
public TagFetchMode download_tags;
1313
public GitProxyOptions ProxyOptions;
14+
public RemoteRedirectMode FollowRedirects = RemoteRedirectMode.Initial;
1415
public GitStrArrayManaged CustomHeaders;
1516
}
1617
}

LibGit2Sharp/Core/GitOdbBackend.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ static GitOdbBackend()
3333
public exists_prefix_callback ExistsPrefix;
3434
public IntPtr Refresh;
3535
public foreach_callback Foreach;
36-
37-
private IntPtr Padding; // TODO: add writemidx
38-
39-
public IntPtr Writepack;
36+
public IntPtr WritePack;
37+
public IntPtr WriteMidx;
4038
public IntPtr Freshen;
4139
public free_callback Free;
4240

LibGit2Sharp/Core/GitPushOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ internal class GitPushOptions
99
public int PackbuilderDegreeOfParallelism;
1010
public GitRemoteCallbacks RemoteCallbacks;
1111
public GitProxyOptions ProxyOptions;
12+
public RemoteRedirectMode FollowRedirects = RemoteRedirectMode.Initial;
1213
public GitStrArrayManaged CustomHeaders;
1314
}
1415
}

LibGit2Sharp/Core/GitWorktree.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ internal class git_worktree_add_options
3737
public int locked;
3838

3939
public IntPtr @ref = IntPtr.Zero;
40+
41+
public GitCheckoutOpts checkoutOpts = new GitCheckoutOpts { version = 1 };
4042
}
4143

4244
[StructLayout(LayoutKind.Sequential)]

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private static string GetGlobalSettingsNativeLibraryPath()
6666
return Path.Combine(nativeLibraryDir, libgit2 + Platform.GetNativeLibraryExtension());
6767
}
6868

69-
#if NETSTANDARD
69+
#if NETFRAMEWORK
7070
private static bool TryUseNativeLibrary() => false;
7171
#else
7272
private static bool TryUseNativeLibrary()

LibGit2Sharp/GlobalSettings.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static class GlobalSettings
2020

2121
private static string nativeLibraryPath;
2222
private static bool nativeLibraryPathLocked;
23-
private static string nativeLibraryDefaultPath;
23+
private static readonly string nativeLibraryDefaultPath = null;
2424

2525
static GlobalSettings()
2626
{
@@ -29,19 +29,18 @@ static GlobalSettings()
2929

3030
nativeLibraryPathAllowed = netFX || netCore;
3131

32+
#if NETFRAMEWORK
3233
if (netFX)
3334
{
3435
// For .NET Framework apps the dependencies are deployed to lib/win32/{architecture} directory
3536
nativeLibraryDefaultPath = Path.Combine(GetExecutingAssemblyDirectory(), "lib", "win32", Platform.ProcessorArchitecture);
3637
}
37-
else
38-
{
39-
nativeLibraryDefaultPath = null;
40-
}
38+
#endif
4139

4240
registeredFilters = new Dictionary<Filter, FilterRegistration>();
4341
}
4442

43+
#if NETFRAMEWORK
4544
private static string GetExecutingAssemblyDirectory()
4645
{
4746
// Assembly.CodeBase is not actually a correctly formatted
@@ -66,6 +65,7 @@ private static string GetExecutingAssemblyDirectory()
6665
managedPath = Path.GetDirectoryName(managedPath);
6766
return managedPath;
6867
}
68+
#endif
6969

7070
/// <summary>
7171
/// Returns information related to the current LibGit2Sharp

0 commit comments

Comments
 (0)