Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bump to master #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
70d62d5
LibGit2Sharp: update to libgit2 v1.6.2
ethomson Feb 23, 2023
d0d8029
Update LibGit2Sharp.NativeBinaries to 2.0.319
bording Apr 7, 2023
d064794
Merge pull request #2025 from libgit2/nativebinaries-update
bording Apr 7, 2023
1be14ba
Update action versions
bording Apr 7, 2023
b5bb4d5
Add .NET 7 and remove .NET Core 3.1
bording Apr 7, 2023
fbbfd71
Fix warning
bording Apr 8, 2023
03cb811
Update testing packages
bording Apr 8, 2023
81d501c
Update Microsoft.SourceLink.GitHub
bording Apr 8, 2023
079daef
Update workflow OSes
bording Apr 8, 2023
f178934
Remove netstandard2.0 and add net472
bording Apr 8, 2023
48460d0
Fix Assembly CodeBase warning
bording Apr 8, 2023
8ae9922
Merge pull request #2026 from libgit2/ci-updates
bording Apr 8, 2023
c157b6a
Update RemoteRedirectMode to match git_remote_redirect_t
bording Apr 8, 2023
8b0e48f
Merge pull request #2027 from libgit2/fix-remote-redirect-mode
bording Apr 8, 2023
a7ded29
Add NuGet package badge (#1980)
mungojam Apr 8, 2023
1d64999
Switch to MinVer for versioning
bording Apr 9, 2023
2da1e0e
Update version test
bording Apr 9, 2023
8e1fe56
Mark repo safe to fix MinVer warning
bording Apr 9, 2023
b0937d0
Merge pull request #2028 from libgit2/minver
bording Apr 9, 2023
9552731
Add v0.27 changes
bording Apr 11, 2023
225e197
Merge pull request #2029 from libgit2/changes
bording Apr 11, 2023
10cd32c
Add PackageReadmeFile property
bording Apr 11, 2023
4dc402a
Fix AssemblyVersion and PackageVersion
bording Apr 11, 2023
82c190b
Add fix to Changes doc
bording Apr 11, 2023
556107a
Merge pull request #2030 from libgit2/package-fixes
bording Apr 11, 2023
2419633
Update LibGit2Sharp.NativeBinaries to 2.0.320
bording Apr 12, 2023
ce3be35
Update CHANGES doc
bording Apr 12, 2023
8c32b61
Merge pull request #2032 from libgit2/libgit2-update
bording Apr 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 26 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ env:
jobs:
build:
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v1.8.1
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: 6.0.x
dotnet-version: 7.0.x
- name: Build
run: dotnet build LibGit2Sharp.sln --configuration Release
- name: Upload packages
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v3.1.2
with:
name: NuGet packages
path: bin/Packages/
Expand All @@ -36,63 +36,56 @@ jobs:
strategy:
matrix:
arch: [ amd64 ]
os: [windows-2019, macos-10.15]
tfm: [ net472, netcoreapp3.1, net6.0 ]
os: [ windows-2019, macos-11 ]
tfm: [ net472, net6.0, net7.0 ]
exclude:
- os: macos-10.15
- os: macos-11
tfm: net472
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v1.8.1
uses: actions/setup-dotnet@v3.0.3
with:
dotnet-version: 6.0.x
- name: Install .NET Core 3.1 runtime
if: matrix.tfm == 'netcoreapp3.1'
uses: actions/[email protected]
with:
dotnet-version: 3.1.x
dotnet-version: |
7.0.x
6.0.x
- name: Run ${{ matrix.tfm }} tests
run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
test-linux:
name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
arch: [ amd64 ]
# arch: [ amd64, arm64 ]
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 ]
sdk: [ '6.0', '3.1' ]
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 ]
sdk: [ '6.0', '7.0' ]
exclude:
- arch: arm64
distro: alpine.3.12
- arch: arm64
distro: alpine.3.13
sdk: '3.1'
- arch: arm64
distro: alpine.3.14
sdk: '3.1'
- arch: arm64
distro: centos.7
- distro: alpine.3.13
sdk: '7.0'
- distro: alpine.3.14
sdk: '7.0'
include:
- sdk: '6.0'
tfm: net6.0
- sdk: '3.1'
tfm: netcoreapp3.1
- sdk: '7.0'
tfm: net7.0
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
uses: actions/checkout@v3.5.0
with:
fetch-depth: 0
- name: Setup QEMU
if: matrix.arch == 'arm64'
run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
- name: Run ${{ matrix.tfm }} tests
run: |
git_command="git config --global --add safe.directory /app"
test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING"
docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$test_command"
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"

44 changes: 35 additions & 9 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
# LibGit2Sharp Changes

**LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .Net and Mono.**

- Source code: <https://github.com/libgit2/libgit2sharp>
- NuGet package: <http://nuget.org/List/Packages/LibGit2Sharp>
- Issue tracker: <https://github.com/libgit2/libgit2sharp/issues>
- @libgit2sharp: <http://twitter.com/libgit2sharp>
- CI servers:
- Windows (x86/amd64): <https://ci.appveyor.com/project/libgit2/libgit2sharp>
- Linux/Mac OS X: <https://travis-ci.org/libgit2/libgit2sharp>
## v0.27.2 - ([diff](https://github.com/libgit2/libgit2sharp/compare/0.27.1..0.27.2))

### Changes
- This release includes [libgit2 v1.6.4](https://github.com/libgit2/libgit2/releases/tag/v1.6.4).

### Fixes
- Can't access GIT config (Repository.Config) since v0.27.0 [#2031](https://github.com/libgit2/libgit2sharp/issues/2031)

## v0.27.1 - ([diff](https://github.com/libgit2/libgit2sharp/compare/0.27.0..0.27.1))

### Fixes
- 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)

## v0.27 - ([diff](https://github.com/libgit2/libgit2sharp/compare/v0.26..0.27.0))

### Changes
- LibGit2Sharp now targets .NET Framework 4.7.2 and .NET 6.
- This release includes [libgit2 v1.6.3](https://github.com/libgit2/libgit2/releases/tag/v1.6.3).
- 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).
- `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)

### Additions
- Add support for adding and clearing multi-valued configuration [#1720](https://github.com/libgit2/libgit2sharp/pull/1720)
- added lines and deleted lines in content changes [#1790](https://github.com/libgit2/libgit2sharp/pull/1790)
- Set / get supported extensions [#1908](https://github.com/libgit2/libgit2sharp/pull/1908)
- Simplify dealing with missing git objects [#1909](https://github.com/libgit2/libgit2sharp/pull/1909)
- Throw NotFoundException if trees are missing when computing diff [#1936](https://github.com/libgit2/libgit2sharp/pull/1936)

### Fixes
- Adjust GitStatusOptions to match structure of native libgit2 [#1884](https://github.com/libgit2/libgit2sharp/pull/1884)
- Update git_worktree_add_options struct to include ref pointer [#1890](https://github.com/libgit2/libgit2sharp/pull/1890)
- Fix git_remote_connect not throwing on non-zero result [#1913](https://github.com/libgit2/libgit2sharp/pull/1913)
- Fix incorrect information in exceptions [#1919](https://github.com/libgit2/libgit2sharp/pull/1919)
- Checkout branch looks to remote tracking branches as fallback [#1820](https://github.com/libgit2/libgit2sharp/pull/1820)
- Fixed calling into native libgit2 on osx-arm64 [#1955](https://github.com/libgit2/libgit2sharp/pull/1955)

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

Expand Down
6 changes: 3 additions & 3 deletions LibGit2Sharp.Tests/BlobFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void CanGetBlobAsFilteredText(string autocrlf, string expectedText)
}
}

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

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

Assert.Equal("a8233120f6ad708f843d861ce2b7228ec4e3dec6", blob.Sha);
Assert.NotNull(blob);
Expand Down
21 changes: 8 additions & 13 deletions LibGit2Sharp.Tests/GlobalSettingsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ public void CanGetMinimumCompiledInFeatures()
public void CanRetrieveValidVersionString()
{
// Version string format is:
// Major.Minor.Patch[-previewTag]+{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features)
// Major.Minor.Patch[-previewTag]+libgit2-{libgit2_abbrev_hash}.{LibGit2Sharp_hash} (arch - features)
// Example output:
// "0.25.0-preview.52+871d13a67f.libgit2-15e1193 (x86 - Threads, Https)"
// "0.27.0-preview.0.1896+libgit2-c058aa8.c1ac3ed74487da5fac24cf1e48dc8ea71e917b75 (x64 - Threads, Https, NSec)"

string versionInfo = GlobalSettings.Version.ToString();

// The GlobalSettings.Version returned string should contain :
// version: '0.25.0[-previewTag]' LibGit2Sharp version number.
// git2SharpHash: '871d13a67f' LibGit2Sharp hash.
// git2SharpHash: 'c1ac3ed74487da5fac24cf1e48dc8ea71e917b75' LibGit2Sharp hash.
// arch: 'x86' or 'x64' libgit2 target.
// git2Features: 'Threads, Ssh' libgit2 features compiled with.
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?\+((?<git2SharpHash>[a-f0-9]{10})\.)?libgit2-[a-f0-9]{7}) \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?)\+libgit2-[a-f0-9]{7}\.((?<git2SharpHash>[a-f0-9]{40}))? \((?<arch>\w+) - (?<git2Features>(?:\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[-previewTag]+{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features). " +
"Major.Minor.Patch[-previewTag]+libgit2-{libgit2_abbrev_hash}.{LibGit2Sharp_hash} (arch - features). " +
"But found \"" + versionInfo + "\" instead.");
}

Expand Down Expand Up @@ -90,22 +90,17 @@ public void SetExtensions()
var extensions = GlobalSettings.GetExtensions();

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

// Disable "noop" extensions
GlobalSettings.SetExtensions("!noop");
extensions = GlobalSettings.GetExtensions();
Assert.Empty(extensions);
Assert.Equal(new[] { "objectformat" }, extensions);

// Enable two new extensions (it will reset the configuration and "noop" will be enabled)
GlobalSettings.SetExtensions("partialclone", "newext");
extensions = GlobalSettings.GetExtensions();
Assert.Equal(new[] { "noop", "partialclone", "newext" }, extensions);

// You can have multiple times the same extension
GlobalSettings.SetExtensions("noop", "test", "test" );
extensions = GlobalSettings.GetExtensions();
Assert.Equal(new[] { "noop", "noop", "test", "test" }, extensions);
Assert.Equal(new[] { "noop", "objectformat", "partialclone", "newext" }, extensions);
}
}
}
14 changes: 7 additions & 7 deletions LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;net6.0;net7.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,12 +11,12 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.console" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="xunit.skippablefact" Version="1.4.13" />
</ItemGroup>

Expand Down
5 changes: 2 additions & 3 deletions LibGit2Sharp.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.202
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibGit2Sharp", "LibGit2Sharp\LibGit2Sharp.csproj", "{EE6ED99F-CB12-4683-B055-D28FC7357A34}"
EndProject
Expand All @@ -13,7 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
Targets\GenerateNativeDllName.targets = Targets\GenerateNativeDllName.targets
nuget.config = nuget.config
version.json = version.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NativeLibraryLoadTestApp.x86", "NativeLibraryLoadTestApp\x86\NativeLibraryLoadTestApp.x86.csproj", "{86453D2C-4953-4DF4-B12A-ADE579608BAA}"
Expand Down
1 change: 1 addition & 0 deletions LibGit2Sharp/Core/GitFetchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal class GitFetchOptions
public bool UpdateFetchHead = true;
public TagFetchMode download_tags;
public GitProxyOptions ProxyOptions;
public RemoteRedirectMode FollowRedirects = RemoteRedirectMode.Initial;
public GitStrArrayManaged CustomHeaders;
}
}
6 changes: 2 additions & 4 deletions LibGit2Sharp/Core/GitOdbBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ static GitOdbBackend()
public exists_prefix_callback ExistsPrefix;
public IntPtr Refresh;
public foreach_callback Foreach;

private IntPtr Padding; // TODO: add writemidx

public IntPtr Writepack;
public IntPtr WritePack;
public IntPtr WriteMidx;
public IntPtr Freshen;
public free_callback Free;

Expand Down
1 change: 1 addition & 0 deletions LibGit2Sharp/Core/GitPushOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal class GitPushOptions
public int PackbuilderDegreeOfParallelism;
public GitRemoteCallbacks RemoteCallbacks;
public GitProxyOptions ProxyOptions;
public RemoteRedirectMode FollowRedirects = RemoteRedirectMode.Initial;
public GitStrArrayManaged CustomHeaders;
}
}
2 changes: 2 additions & 0 deletions LibGit2Sharp/Core/GitWorktree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ internal class git_worktree_add_options
public int locked;

public IntPtr @ref = IntPtr.Zero;

public GitCheckoutOpts checkoutOpts = new GitCheckoutOpts { version = 1 };
}

[StructLayout(LayoutKind.Sequential)]
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static string GetGlobalSettingsNativeLibraryPath()
return Path.Combine(nativeLibraryDir, libgit2 + Platform.GetNativeLibraryExtension());
}

#if NETSTANDARD
#if NETFRAMEWORK
private static bool TryUseNativeLibrary() => false;
#else
private static bool TryUseNativeLibrary()
Expand Down
10 changes: 5 additions & 5 deletions LibGit2Sharp/GlobalSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static class GlobalSettings

private static string nativeLibraryPath;
private static bool nativeLibraryPathLocked;
private static string nativeLibraryDefaultPath;
private static readonly string nativeLibraryDefaultPath = null;

static GlobalSettings()
{
Expand All @@ -29,19 +29,18 @@ static GlobalSettings()

nativeLibraryPathAllowed = netFX || netCore;

#if NETFRAMEWORK
if (netFX)
{
// For .NET Framework apps the dependencies are deployed to lib/win32/{architecture} directory
nativeLibraryDefaultPath = Path.Combine(GetExecutingAssemblyDirectory(), "lib", "win32", Platform.ProcessorArchitecture);
}
else
{
nativeLibraryDefaultPath = null;
}
#endif

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

#if NETFRAMEWORK
private static string GetExecutingAssemblyDirectory()
{
// Assembly.CodeBase is not actually a correctly formatted
Expand All @@ -66,6 +65,7 @@ private static string GetExecutingAssemblyDirectory()
managedPath = Path.GetDirectoryName(managedPath);
return managedPath;
}
#endif

/// <summary>
/// Returns information related to the current LibGit2Sharp
Expand Down
Loading