Skip to content

Reuse created commits for all branches as commits are shared. #4553

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"src"
],
"sdk": {
"version": "9.0.203"
"version": "9.0.300"
}
}
2 changes: 2 additions & 0 deletions src/GitVersion.App/GitVersion.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<AssemblyName>gitversion</AssemblyName>
<PlatformTarget>AnyCPU</PlatformTarget>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PublishSingleFile>true</PublishSingleFile>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition=" '$(PackAsTool)' == 'true' ">
Expand Down
65 changes: 40 additions & 25 deletions src/GitVersion.Core/Core/RepositoryStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,52 +116,67 @@ public IEnumerable<IBranch> GetSourceBranches(
var commitBranches = FindCommitBranchesBranchedFrom(branch, configuration, excludedBranches).ToHashSet();

var ignore = new HashSet<BranchCommit>();
foreach (var commitBranch in commitBranches)
using (this.log.IndentLog($"Finding ignore branches"))
{
foreach (var commit in branch.Commits.Where(element => element.When > commitBranch.Commit.When))
foreach (var commitBranch in commitBranches)
{
var parents = commit.Parents.ToArray();
if (parents.Length > 1 && parents.Any(element => element.Equals(commitBranch.Commit)))
foreach (var commit in branch.Commits.Where(element => element.When > commitBranch.Commit.When))
{
ignore.Add(commitBranch);
var parents = commit.Parents.ToArray();
if (parents.Length > 1 && parents.Any(element => element.Equals(commitBranch.Commit)))
{
ignore.Add(commitBranch);
}
}
}
}

foreach (var item in commitBranches.Skip(1).Reverse())
using (this.log.IndentLog($"Filtering out branches"))
{
if (ignore.Contains(item)) continue;
IEnumerable<BranchCommit> commitBranchesReversed = new List<BranchCommit>();
using (this.log.IndentLog($"Reverse commit branches"))
{
commitBranchesReversed = commitBranches.Skip(1).Reverse();
}

foreach (var commitBranch in commitBranches)
foreach (var item in commitBranchesReversed)
{
if (item.Commit.Equals(commitBranch.Commit)) break;
if (ignore.Contains(item)) continue;

foreach (var commit in commitBranch.Branch.Commits.Where(element => element.When >= item.Commit.When))
foreach (var commitBranch in commitBranches)
{
if (commit.Equals(item.Commit))
if (item.Commit.Equals(commitBranch.Commit)) break;

foreach (var commit in commitBranch.Branch.Commits.Where(element => element.When >= item.Commit.When))
{
commitBranches.Remove(item);
if (commit.Equals(item.Commit))
{
commitBranches.Remove(item);
}
}
}
}
}

foreach (var branchGrouping in commitBranches.GroupBy(element => element.Commit, element => element.Branch))
using (this.log.IndentLog($"Iterate grouped branches by commit"))
{
var referenceMatchFound = false;
var referenceNames = referenceLookup[branchGrouping.Key.Sha].Select(element => element.Name).ToHashSet();

foreach (var item in branchGrouping)
foreach (var branchGrouping in commitBranches.GroupBy(element => element.Commit, element => element.Branch))
{
if (!referenceNames.Contains(item.Name)) continue;
if (returnedBranches.Add(item)) yield return item;
referenceMatchFound = true;
}
var referenceMatchFound = false;
var referenceNames = referenceLookup[branchGrouping.Key.Sha].Select(element => element.Name).ToHashSet();

if (referenceMatchFound) continue;
foreach (var item in branchGrouping)
{
if (returnedBranches.Add(item)) yield return item;
foreach (var item in branchGrouping)
{
if (!referenceNames.Contains(item.Name)) continue;
if (returnedBranches.Add(item)) yield return item;
referenceMatchFound = true;
}

if (referenceMatchFound) continue;
foreach (var item in branchGrouping)
{
if (returnedBranches.Add(item)) yield return item;
}
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion src/GitVersion.LibGit2Sharp/Git/Commit.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using GitVersion.Extensions;
using GitVersion.Helpers;
using LibGit2Sharp;

namespace GitVersion.Git;

Expand All @@ -14,7 +15,16 @@
internal Commit(LibGit2Sharp.Commit innerCommit) : base(innerCommit)
{
this.innerCommit = innerCommit.NotNull();
this.parentsLazy = new(() => innerCommit.Parents.Select(parent => new Commit(parent)).ToList());
this.parentsLazy = new Lazy<IReadOnlyList<ICommit>>(() => innerCommit.Parents.Select(parent =>
{
ICommit gvCommit;
if (!CommitCollection.s_commits.TryGetValue(parent, out gvCommit))

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / DotNet Format

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / DotNet Format

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / DotNet Format

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Converting null literal or possible null value to non-nullable type.

Check warning on line 21 in src/GitVersion.LibGit2Sharp/Git/Commit.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Converting null literal or possible null value to non-nullable type.
{
gvCommit = new Commit(parent);
CommitCollection.s_commits.Add(parent, gvCommit);
}
return gvCommit;
}).ToList());
When = innerCommit.Committer.When;
}

Expand Down
20 changes: 19 additions & 1 deletion src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,31 @@

internal sealed class CommitCollection : ICommitCollection
{
public static Dictionary<LibGit2Sharp.Commit, ICommit> s_commits = new Dictionary<LibGit2Sharp.Commit, ICommit>();

private readonly ICommitLog innerCollection;
private readonly Lazy<IReadOnlyCollection<ICommit>> commits;

internal CommitCollection(ICommitLog collection)
{
this.innerCollection = collection.NotNull();
this.commits = new Lazy<IReadOnlyCollection<ICommit>>(() => [.. this.innerCollection.Select(commit => new Commit(commit))]);
this.commits = new Lazy<IReadOnlyCollection<ICommit>>(() => {
List<ICommit> commits = new List<ICommit>();
foreach (var c in this.innerCollection) {
ICommit gvCommit;
if (s_commits.TryGetValue(c, out gvCommit))

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / DotNet Format

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / DotNet Format

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Converting null literal or possible null value to non-nullable type.

Check warning on line 20 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Converting null literal or possible null value to non-nullable type.
{
commits.Add(gvCommit);

Check warning on line 22 in src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs

View workflow job for this annotation

GitHub Actions / DotNet Format

Converting null literal or possible null value to non-nullable type.
}
else
{
gvCommit = new Commit(c);
commits.Add(gvCommit);
s_commits[c] = gvCommit;
}
}
return commits;
});
}

public IEnumerator<ICommit> GetEnumerator()
Expand Down
55 changes: 49 additions & 6 deletions src/GitVersion.LibGit2Sharp/Git/GitRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,56 @@
public string WorkingDirectory => RepositoryInstance.Info.WorkingDirectory;
public bool IsHeadDetached => RepositoryInstance.Info.IsHeadDetached;
public bool IsShallow => RepositoryInstance.Info.IsShallow;
public IBranch Head => new Branch(RepositoryInstance.Head);

public ITagCollection Tags => new TagCollection(RepositoryInstance.Tags);
public IReferenceCollection Refs => new ReferenceCollection(RepositoryInstance.Refs);
public IBranchCollection Branches => new BranchCollection(RepositoryInstance.Branches);
public ICommitCollection Commits => new CommitCollection(RepositoryInstance.Commits);
public IRemoteCollection Remotes => new RemoteCollection(RepositoryInstance.Network.Remotes);
private IBranch _head = null;

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 25 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Cannot convert null literal to non-nullable reference type.
public IBranch Head {
get {
_head ??= new Branch(RepositoryInstance.Head);
return _head;
}
}

private ITagCollection _tags = null;

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 33 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Cannot convert null literal to non-nullable reference type.
public ITagCollection Tags {
get {
_tags ??= new TagCollection(RepositoryInstance.Tags);
return _tags;
}
}

private IReferenceCollection _refs = null;

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 41 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Cannot convert null literal to non-nullable reference type.
public IReferenceCollection Refs {
get {
_refs ??= new ReferenceCollection(RepositoryInstance.Refs);
return _refs;
}
}

private IBranchCollection _branches = null;

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 49 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Cannot convert null literal to non-nullable reference type.
public IBranchCollection Branches {
get {
_branches ??= new BranchCollection(RepositoryInstance.Branches);
return _branches;
}
}

private ICommitCollection _commits = null;

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 57 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Cannot convert null literal to non-nullable reference type.
public ICommitCollection Commits
{
get
{
_commits ??= new CommitCollection(RepositoryInstance.Commits);
return _commits;
}
}

public IRemoteCollection _remotes = null;

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Prepare / windows-2025

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / macos-15 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / macos-15

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / ubuntu-24.04 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net9.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / ubuntu-24.04

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Test / windows-2025 - net8.0

Cannot convert null literal to non-nullable reference type.

Check warning on line 67 in src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

View workflow job for this annotation

GitHub Actions / Build & Package / windows-2025

Cannot convert null literal to non-nullable reference type.
public IRemoteCollection Remotes {
get {
_remotes ??= new RemoteCollection(RepositoryInstance.Network.Remotes);
return _remotes;
}
}

public void DiscoverRepository(string? gitDirectory)
{
Expand Down
Loading