Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2cad6cd
Add project to test trimming compatibility
bording Mar 14, 2024
70ac848
Address trimming warnings
bording Mar 14, 2024
29b7380
Use .NET 8 SDK
bording Mar 14, 2024
ea4e6c9
Fix failing test
bording Mar 16, 2024
d9bf967
Merge pull request #2084 from libgit2/trimming
bording Mar 16, 2024
4e8e00e
Add net8.0 test targets
bording Mar 16, 2024
2b585e9
Use .NET 8 SDK artifacts output
bording Mar 16, 2024
c9352c3
Update packages
bording Mar 16, 2024
9e4669c
Fix test analyzer warnings
bording Mar 16, 2024
8d79ff4
Update workflow actions
bording Mar 16, 2024
4193f6b
Update testing matrix
bording Mar 16, 2024
c407371
Fix analyzer warnings
bording Mar 16, 2024
729ef8d
Clean up more analyzer warnings
bording Mar 16, 2024
bfdb02a
Merge pull request #2085 from libgit2/net8-updates
bording Mar 16, 2024
e170336
Update LibGit2Sharp.NativeBinaries to 2.0.322
bording Mar 16, 2024
a373623
Increase assert range to avoid flaky tests
bording Mar 17, 2024
2b84c8e
Merge pull request #2086 from libgit2/native-binaries
bording Mar 17, 2024
5085a0c
Update CHANGES.md for v0.30
bording Mar 19, 2024
77cfeaf
Remove macos-11
bording Nov 21, 2024
66f6940
Use private protected
bording Nov 21, 2024
a88e2a0
Use SafeHandles (#2127)
bording Nov 21, 2024
f4fc144
Updates (#2128)
bording Nov 22, 2024
d935c49
Fix test warnings
bording Nov 23, 2024
0eed453
Run dotnet format
bording Nov 23, 2024
5162c68
Fix tests
bording Nov 23, 2024
47b2ee0
Adds Depth to FetchOptions allowing for shallow cloning (#2070)
andersklepaker Nov 23, 2024
19236db
Tweak shallow cloning implementation
bording Nov 23, 2024
e1a94a1
Update LibGit2Sharp.NativeBinaries to 2.0.323
bording Nov 23, 2024
95b283b
React to ABI changes
bording Nov 24, 2024
9a11cbd
Update tests
bording Nov 24, 2024
8ef523d
Comment out SSH test for now
bording Nov 24, 2024
17a2dee
Merge pull request #2131 from libgit2/libgit2-184
bording Nov 24, 2024
aacf7cd
Add a CloneOptions constructor that takes a FetchOptions
bording Nov 24, 2024
0961ea7
Merge pull request #2132 from libgit2/clone-options-ctor
bording Nov 24, 2024
08fafd5
Set GIT_CHECKOUT_FORCE as checkout strategy when creating a worktree
Jun 4, 2024
f145a2c
Tweaks
bording Nov 24, 2024
704a25b
Use safe instead of force
bording Nov 24, 2024
5fd810d
Merge pull request #2099 from enriqueraso/bug/Repositoy.Worktrees.Add…
bording Nov 24, 2024
9014820
Make owner validation configurable
ltrzesniewski May 7, 2024
f218572
Undo gitignore change
bording Nov 26, 2024
d623e3e
Tweaks
bording Nov 26, 2024
b8f974f
Merge pull request #2093 from ltrzesniewski/owner-validation
bording Nov 26, 2024
d89638c
fix #2071 ObjectDatabase.Write<T>(Stream, long) does not respect T
tyrielv Jan 4, 2024
af85e63
Merge pull request #2072 from tyrielv/user/tyvella/objectdatabase-wri…
bording Nov 26, 2024
2dd7eca
Test and fix for https://github.com/libgit2/libgit2sharp/issues/1869
tyrielv Feb 11, 2021
3318b73
Merge pull request #1870 from tyrielv/tree-definition-delete
bording Nov 26, 2024
ee53bdd
Update CHANGES.md for v0.31
bording Dec 3, 2024
8276589
Add note about new SSH support
bording Dec 3, 2024
50d6978
Use arm runner images (#2141)
bording Jan 20, 2025
cb58177
Fix libgit2 link (#2170)
suterma Oct 30, 2025
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
73 changes: 42 additions & 31 deletions 73 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,77 +15,88 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.2
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v3.0.3
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 7.0.x
dotnet-version: 9.0.x
- name: Build
run: dotnet build LibGit2Sharp.sln --configuration Release
- name: Upload packages
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4.3.1
with:
name: NuGet packages
path: bin/Packages/
path: artifacts/package/
retention-days: 7
- name: Verify trimming compatibility
run: dotnet publish TrimmingTestApp
test:
name: Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
arch: [ amd64 ]
os: [ windows-2019, macos-11 ]
tfm: [ net472, net6.0, net7.0 ]
arch: [ x64 ]
os: [ windows-2019, windows-2022, macos-13 ]
tfm: [ net472, net8.0, net9.0 ]
exclude:
- os: macos-11
- os: macos-13
tfm: net472
include:
- arch: arm64
os: macos-14
tfm: net8.0
- arch: arm64
os: macos-14
tfm: net9.0
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.2
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v3.0.3
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: |
7.0.x
6.0.x
9.0.x
8.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-22.04
runs-on: ${{ matrix.runnerImage }}
strategy:
matrix:
arch: [ amd64 ]
# arch: [ amd64, arm64 ]
distro: [ alpine.3.13, alpine.3.14, alpine.3.15, alpine.3.16, alpine.3.17, centos.stream.8, debian.10, debian.11, fedora.36, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
sdk: [ '6.0', '7.0' ]
arch: [ amd64, arm64 ]
distro: [ alpine.3.17, alpine.3.18, alpine.3.19, alpine.3.20, centos.stream.9, debian.12, fedora.40, ubuntu.20.04, ubuntu.22.04, ubuntu.24.04 ]
sdk: [ '8.0', '9.0' ]
exclude:
- distro: alpine.3.13
sdk: '7.0'
- distro: alpine.3.14
sdk: '7.0'
- distro: alpine.3.17
sdk: '9.0'
- distro: alpine.3.18
sdk: '9.0'
- distro: alpine.3.19
sdk: '9.0'
include:
- sdk: '6.0'
tfm: net6.0
- sdk: '7.0'
tfm: net7.0
- sdk: '8.0'
tfm: net8.0
- sdk: '9.0'
tfm: net9.0
- arch: amd64
runnerImage: ubuntu-22.04
- arch: arm64
runnerImage: ubuntu-22.04-arm
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3.5.0
uses: actions/checkout@v4.1.2
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 "$git_command && $test_command"
docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" -e OPENSSL_ENABLE_SHA1_SIGNATURES=1 gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command"

2 changes: 1 addition & 1 deletion 2 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ _ReSharper*/
*.DotSettings

_NCrunch_LibGit2Sharp/
packages/
artifacts/
worktree.playlist
27 changes: 26 additions & 1 deletion 27 CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# LibGit2Sharp Changes

## v0.31 - ([diff](https://github.com/libgit2/libgit2sharp/compare/0.30.0..0.31.0))

### Changes
- This release includes [libgit2 v1.8.4](https://github.com/libgit2/libgit2/releases/tag/v1.8.4).
- SSH is now supported through [libgit2's support for OpenSSH](https://github.com/libgit2/libgit2/pull/6617).
- The ppc64le architecture is now supported on Linux.
- .NET 6 has reached end of support, so LibGit2Sharp now targets `net472` and `net8.0`.

### Additions
- Adds Depth to FetchOptions allowing for shallow cloning [#2070](https://github.com/libgit2/libgit2sharp/pull/2070)
- Make owner validation configurable [#2093](https://github.com/libgit2/libgit2sharp/pull/2093)
- Add a CloneOptions constructor that takes a FetchOptions [#2132](https://github.com/libgit2/libgit2sharp/pull/2132)

### Fixes
- TreeDefinition.Remove fails to remove unwrapped trees [#1869](https://github.com/libgit2/libgit2sharp/issues/1869)
- ObjectDatabase.Write<T>(Stream stream...) overload does not respect T [#2071](https://github.com/libgit2/libgit2sharp/issues/2071)
- Repository.Worktrees.Add leaves now worktree empty [#2037](https://github.com/libgit2/libgit2sharp/issues/2037)

## v0.30 - ([diff](https://github.com/libgit2/libgit2sharp/compare/0.29.0..0.30.0))

### Changes
- This release includes [libgit2 v1.7.2](https://github.com/libgit2/libgit2/releases/tag/v1.7.2).
- Updates for trimming compatibility [#2084](https://github.com/libgit2/libgit2sharp/pull/2084)
- Updates for .NET 8 [#2085](https://github.com/libgit2/libgit2sharp/pull/2085)

## v0.29 - ([diff](https://github.com/libgit2/libgit2sharp/compare/0.28.0..0.29.0))

### Changes
Expand All @@ -8,7 +33,7 @@

### Additions
- Add proxy options [#2065](https://github.com/libgit2/libgit2sharp/pull/2065)
- See PR for details, including some breaking changes to `CloneOptions` and `SubmoduleUpdateOptions`
- See PR for details, including some breaking changes to `CloneOptions` and `SubmoduleUpdateOptions`

## v0.28 - ([diff](https://github.com/libgit2/libgit2sharp/compare/0.27.2..0.28.0))

Expand Down
5 changes: 2 additions & 3 deletions 5 Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<Project>

<PropertyGroup>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputPath>$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\Packages\</PackageOutputPath>
<UseArtifactsOutput>true</UseArtifactsOutput>
<DefineConstants Condition=" '$(ExtraDefine)' != '' ">$(DefineConstants);$(ExtraDefine)</DefineConstants>
</PropertyGroup>

Expand Down
10 changes: 5 additions & 5 deletions 10 LibGit2Sharp.Tests/BlameFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ public void CanBlameFromVariousTypes()
string path = SandboxBareTestRepo();
using (var repo = new Repository(path))
{
AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions {StartingAt = "HEAD" }));
AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions {StartingAt = repo.Head }));
AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions {StartingAt = repo.Head.Tip }));
AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions {StartingAt = repo.Branches["master"]}));
AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions { StartingAt = "HEAD" }));
AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions { StartingAt = repo.Head }));
AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions { StartingAt = repo.Head.Tip }));
AssertCorrectHeadBlame(repo.Blame("README", new BlameOptions { StartingAt = repo.Branches["master"] }));
}
}

Expand All @@ -78,7 +78,7 @@ public void CanStopBlame()
// $ git blame .\new.txt
// 9fd738e8 (Scott Chacon 2010-05-24 10:19:19 -0700 1) my new file
// (be3563a comes after 9fd738e8)
var blame = repo.Blame("new.txt", new BlameOptions {StoppingAt = "be3563a"});
var blame = repo.Blame("new.txt", new BlameOptions { StoppingAt = "be3563a" });
Assert.StartsWith("be3563a", blame[0].FinalCommit.Sha);
}
}
Expand Down
5 changes: 2 additions & 3 deletions 5 LibGit2Sharp.Tests/BranchFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
using Xunit.Extensions;

namespace LibGit2Sharp.Tests
{
Expand Down Expand Up @@ -103,7 +102,7 @@ public void CanCreateAnUnbornBranch()
public void CanCreateBranchUsingAbbreviatedSha()
{
string path = SandboxBareTestRepo();
using (var repo = new Repository(path, new RepositoryOptions{ Identity = Constants.Identity }))
using (var repo = new Repository(path, new RepositoryOptions { Identity = Constants.Identity }))
{
EnableRefLog(repo);

Expand Down Expand Up @@ -1001,7 +1000,7 @@ public void OnlyOneBranchIsTheHead()
continue;
}

Assert.True(false, string.Format("Both '{0}' and '{1}' appear to be Head.", head.CanonicalName, branch.CanonicalName));
Assert.Fail(string.Format("Both '{0}' and '{1}' appear to be Head.", head.CanonicalName, branch.CanonicalName));
}

Assert.NotNull(head);
Expand Down
8 changes: 4 additions & 4 deletions 8 LibGit2Sharp.Tests/CheckoutFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public void CanForcefullyCheckoutWithConflictingStagedChanges()
Assert.Throws<CheckoutConflictException>(() => Commands.Checkout(repo, master.CanonicalName));

// Checkout with force option should succeed.
Commands.Checkout(repo, master.CanonicalName, new CheckoutOptions() { CheckoutModifiers = CheckoutModifiers.Force});
Commands.Checkout(repo, master.CanonicalName, new CheckoutOptions() { CheckoutModifiers = CheckoutModifiers.Force });

// Assert that master branch is checked out.
Assert.True(repo.Branches["master"].IsCurrentRepositoryHead);
Expand Down Expand Up @@ -411,7 +411,7 @@ public void CheckingOutThroughBranchCallsCheckoutProgress()

Branch branch = repo.Branches[otherBranchName];
Commands.Checkout(repo, branch,
new CheckoutOptions { OnCheckoutProgress = (path, completed, total) => wasCalled = true});
new CheckoutOptions { OnCheckoutProgress = (path, completed, total) => wasCalled = true });

Assert.True(wasCalled);
}
Expand All @@ -427,7 +427,7 @@ public void CheckingOutThroughRepositoryCallsCheckoutProgress()
PopulateBasicRepository(repo);
bool wasCalled = false;

Commands.Checkout(repo, otherBranchName, new CheckoutOptions() { OnCheckoutProgress = (path, completed, total) => wasCalled = true});
Commands.Checkout(repo, otherBranchName, new CheckoutOptions() { OnCheckoutProgress = (path, completed, total) => wasCalled = true });

Assert.True(wasCalled);
}
Expand Down Expand Up @@ -779,7 +779,7 @@ public void CheckoutFromDetachedHead(string commitPointer)
public void CheckoutBranchFromDetachedHead()
{
string path = SandboxStandardTestRepo();
using (var repo = new Repository(path, new RepositoryOptions{ Identity = Constants.Identity }))
using (var repo = new Repository(path, new RepositoryOptions { Identity = Constants.Identity }))
{
// Set the working directory to the current head
ResetAndCleanWorkingDirectory(repo);
Expand Down
32 changes: 30 additions & 2 deletions 32 LibGit2Sharp.Tests/CloneFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ public void CanClone(string url)
}
}

[Theory]
[InlineData("https://github.com/libgit2/TestGitRepository", 1)]
[InlineData("https://github.com/libgit2/TestGitRepository", 5)]
[InlineData("https://github.com/libgit2/TestGitRepository", 7)]
public void CanCloneShallow(string url, int depth)
{
var scd = BuildSelfCleaningDirectory();

var clonedRepoPath = Repository.Clone(url, scd.DirectoryPath, new CloneOptions
{
FetchOptions =
{
Depth = depth,
},
});

using (var repo = new Repository(clonedRepoPath))
{
var commitsFirstParentOnly = repo.Commits.QueryBy(new CommitFilter
{
FirstParentOnly = true,
});

Assert.Equal(depth, commitsFirstParentOnly.Count());
Assert.Equal("49322bb17d3acc9146f98c97d078513228bbf3c0", repo.Head.Tip.Id.ToString());
}
}

[Theory]
[InlineData("br2", "a4a7dce85cf63874e984719f4fdd239f5145052f")]
[InlineData("packed", "41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9")]
Expand Down Expand Up @@ -238,7 +266,7 @@ static Credentials CreateUsernamePasswordCredentials(string user, string pass, b

[SkippableTheory]
[InlineData("https://github.com/libgit2/TestGitRepository.git", "github.com", typeof(CertificateX509))]
[InlineData("git@github.com:libgit2/TestGitRepository.git", "github.com", typeof(CertificateSsh))]
//[InlineData("git@github.com:libgit2/TestGitRepository.git", "github.com", typeof(CertificateSsh))]
public void CanInspectCertificateOnClone(string url, string hostname, Type certType)
{
var scd = BuildSelfCleaningDirectory();
Expand Down Expand Up @@ -267,7 +295,7 @@ public void CanInspectCertificateOnClone(string url, string hostname, Type certT
Assert.True(valid);
var x509 = ((CertificateX509)cert).Certificate;
// we get a string with the different fields instead of a structure, so...
Assert.Contains("CN=github.com,", x509.Subject);
Assert.Contains("CN=github.com", x509.Subject);
checksHappy = true;
return false;
}
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.