Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GitTools/GitVersion
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.9.0
Choose a base ref
...
head repository: GitTools/GitVersion
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.10.0
Choose a head ref
Loading
Showing with 1,781 additions and 889 deletions.
  1. +6 −0 .editorconfig
  2. +25 −25 .github/workflows/ci.yml
  3. +3 −3 .github/workflows/codeql-analysis.yml
  4. +13 −7 .github/workflows/docs.yml
  5. +2 −2 .github/workflows/format.yml
  6. +1 −1 .github/workflows/release.yml
  7. +1 −0 .gitignore
  8. +2 −0 GitVersion.yml
  9. +1 −1 build/build/Tasks/Test/PublishCoverage.cs
  10. +5 −4 build/common/Utilities/BuildContextBase.cs
  11. +6 −3 build/common/Utilities/BuildLifetimeBase.cs
  12. +3 −10 build/common/Utilities/ContextExtensions.cs
  13. +1 −1 build/publish/Tasks/PublishNuget.cs
  14. +2 −0 docs/input/docs/learn/who.md
  15. +77 −0 docs/input/docs/reference/build-servers/bitbucket-pipelines.md
  16. +2 −1 docs/input/docs/reference/build-servers/buildkite.md
  17. +6 −6 package-lock.json
  18. +1 −1 src/Directory.Build.props
  19. +1 −1 src/GitVersion.App.Tests/ArgumentParserTests.cs
  20. +1 −1 src/GitVersion.App.Tests/HelpWriterTests.cs
  21. +13 −0 src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs
  22. +1 −1 src/GitVersion.App/ArgumentParser.cs
  23. +2 −2 src/GitVersion.App/Arguments.cs
  24. +39 −0 src/GitVersion.Core.Tests/BuildAgents/AzurePipelinesTests.cs
  25. +173 −0 src/GitVersion.Core.Tests/BuildAgents/BitBucketPipelinesTests.cs
  26. +1 −1 src/GitVersion.Core.Tests/BuildAgents/BuildKiteTests.cs
  27. +26 −0 src/GitVersion.Core.Tests/BuildAgents/CodeBuildTests.cs
  28. +2 −2 src/GitVersion.Core.Tests/BuildAgents/GitHubActionsTests.cs
  29. +3 −4 src/GitVersion.Core.Tests/BuildAgents/SpaceAutomationTests.cs
  30. +30 −0 src/GitVersion.Core.Tests/Configuration/ConfigExtensionsTests.cs
  31. +1 −1 src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs
  32. +28 −5 src/GitVersion.Core.Tests/Helpers/TestEffectiveConfiguration.cs
  33. +14 −14 src/GitVersion.Core.Tests/Model/CommitDateTests.cs
  34. +11 −1 src/GitVersion.Core/BuildAgents/AzurePipelines.cs
  35. +65 −0 src/GitVersion.Core/BuildAgents/BitBucketPipelines.cs
  36. +3 −3 src/GitVersion.Core/BuildAgents/BuildKite.cs
  37. +11 −3 src/GitVersion.Core/BuildAgents/CodeBuild.cs
  38. +12 −1 src/GitVersion.Core/BuildAgents/GitHubActions.cs
  39. +3 −1 src/GitVersion.Core/BuildAgents/GitLabCi.cs
  40. +9 −1 src/GitVersion.Core/BuildAgents/SpaceAutomation.cs
  41. +4 −87 src/GitVersion.Core/Configuration/ConfigExtensions.cs
  42. +2 −1 src/GitVersion.Core/Core/Abstractions/IRepositoryStore.cs
  43. +80 −0 src/GitVersion.Core/Core/BranchesContainingCommitFinder.cs
  44. +112 −106 src/GitVersion.Core/Core/GitPreparer.cs
  45. +2 −1 src/GitVersion.Core/Core/GitVersionContextFactory.cs
  46. +124 −0 src/GitVersion.Core/Core/MainlineBranchFinder.cs
  47. +123 −0 src/GitVersion.Core/Core/MergeBaseFinder.cs
  48. +60 −0 src/GitVersion.Core/Core/MergeCommitFinder.cs
  49. +95 −344 src/GitVersion.Core/Core/RepositoryStore.cs
  50. +66 −0 src/GitVersion.Core/Core/SourceBranchFinder.cs
  51. +2 −0 src/GitVersion.Core/GitVersion.Core.csproj.DotSettings
  52. +120 −39 src/GitVersion.Core/Model/Configuration/EffectiveConfiguration.cs
  53. +1 −1 src/GitVersion.Core/Model/RepositoryInfo.cs
  54. +9 −4 src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs
  55. +1 −1 src/GitVersion.Core/VersionCalculation/MainlineVersionCalculator.cs
  56. +6 −7 src/GitVersion.LibGit2Sharp/Git/Branch.cs
  57. +30 −6 src/GitVersion.LibGit2Sharp/Git/BranchCollection.cs
  58. +5 −6 src/GitVersion.LibGit2Sharp/Git/Commit.cs
  59. +9 −10 src/GitVersion.LibGit2Sharp/Git/CommitCollection.cs
  60. +2 −0 src/GitVersion.LibGit2Sharp/Git/GitObject.cs
  61. +121 −122 src/GitVersion.LibGit2Sharp/Git/GitRepository.cs
  62. +2 −2 src/GitVersion.LibGit2Sharp/Git/GitRepositoryInfo.cs
  63. +4 −1 src/GitVersion.LibGit2Sharp/Git/ObjectId.cs
  64. +5 −5 src/GitVersion.LibGit2Sharp/Git/RefSpec.cs
  65. +6 −1 src/GitVersion.LibGit2Sharp/Git/RefSpecCollection.cs
  66. +6 −4 src/GitVersion.LibGit2Sharp/Git/Reference.cs
  67. +5 −1 src/GitVersion.LibGit2Sharp/Git/ReferenceCollection.cs
  68. +6 −5 src/GitVersion.LibGit2Sharp/Git/Remote.cs
  69. +11 −3 src/GitVersion.LibGit2Sharp/Git/RemoteCollection.cs
  70. +8 −6 src/GitVersion.LibGit2Sharp/Git/Tag.cs
  71. +7 −2 src/GitVersion.LibGit2Sharp/Git/TagCollection.cs
  72. +141 −17 src/GitVersion.sln.DotSettings
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -155,6 +155,12 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# Alignment
align_multiline_parameter = true

# Qualify fields with "this."
csharp_instance_members_qualify_members = field

# IDE0011: Add braces
dotnet_diagnostic.IDE0011.severity = none

50 changes: 25 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ on:
- main
- 'fix/*'
- 'feature/*'
- 'release/*'
- 'support/*'
paths:
- '**'
- '!docs/**'

pull_request:
branches:
- main
- 'release/*'
- 'support/*'
paths:
- '**'
- '!docs/**'
@@ -46,7 +46,7 @@ jobs:
-
name: Cache cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -78,14 +78,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -141,14 +141,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -180,14 +180,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -226,14 +226,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -290,14 +290,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -322,48 +322,48 @@ jobs:
dotnet-version: '6.0.x'
-
name: Login to DockerHub
if: success() && github.event_name != 'pull_request'
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: '[Docker Build/Test/Publish (amd64)] DockerHub'
if: success() && github.event_name != 'pull_request'
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
shell: pwsh
run: dotnet run/docker.dll --target=DockerPublish --arch amd64 --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }} --docker_registry dockerhub
-
name: '[Docker Build/Test/Publish (arm64)] DockerHub'
if: success() && github.event_name != 'pull_request'
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
shell: pwsh
run: dotnet run/docker.dll --target=DockerPublish --arch arm64 --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }} --docker_registry dockerhub
-
name: '[Docker Publish Manifest] DockerHub'
if: success() && github.event_name != 'pull_request'
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
shell: pwsh
run: dotnet run/docker.dll --target=DockerManifest --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }} --docker_registry dockerhub

-
name: Login to GitHub Container Registry
if: success() && github.event_name != 'pull_request' && github.repository == 'GitTools/GitVersion'
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
-
name: '[Docker Build/Test/Publish (amd64)] GitHub Container Registry'
if: success() && github.event_name != 'pull_request' && github.repository == 'GitTools/GitVersion'
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
shell: pwsh
run: dotnet run/docker.dll --target=DockerPublish --arch amd64 --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }} --docker_registry github
-
name: '[Docker Build/Test/Publish (arm64)] GitHub Container Registry'
if: success() && github.event_name != 'pull_request' && github.repository == 'GitTools/GitVersion'
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
shell: pwsh
run: dotnet run/docker.dll --target=DockerPublish --arch arm64 --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }} --docker_registry github
-
name: '[Docker Publish Manifest] GitHub Container Registry'
if: success() && github.event_name != 'pull_request' && github.repository == 'GitTools/GitVersion'
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools'
shell: pwsh
run: dotnet run/docker.dll --target=DockerManifest --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }} --docker_registry github

@@ -388,14 +388,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -430,14 +430,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -4,15 +4,15 @@ on:
push:
branches:
- main
- 'release/*'
- 'support/*'
paths:
- '**'
- '!docs/**'

pull_request:
branches:
- main
- 'release/*'
- 'support/*'
paths:
- '**'
- '!docs/**'
@@ -45,7 +45,7 @@ jobs:
-
name: Cache cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
20 changes: 13 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,9 @@ name: Verify & Publish Docs
on:
workflow_dispatch:
push:
branches:
# - main
- 'support/*'
paths:
- docs/**
- package*.json
@@ -11,6 +14,9 @@ on:
- mkdocs.yml
- .github/workflows/docs.yml
pull_request:
branches:
# - main
- 'support/*'
paths:
- docs/**
- package*.json
@@ -39,14 +45,14 @@ jobs:
-
name: Cache cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -57,7 +63,7 @@ jobs:
-
name: Cache Node Modules
id: cache-node
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: ${{ steps.cache-node-dir.outputs.dir }}
key: node-${{ runner.os }}-${{ hashFiles('./package-lock.json') }}
@@ -85,14 +91,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
@@ -142,14 +148,14 @@ jobs:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v2.1.7
uses: actions/cache@v3.0.2
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
4 changes: 2 additions & 2 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -6,15 +6,15 @@ on:
- main
- 'fix/*'
- 'feature/*'
- 'release/*'
- 'support/*'
paths:
- '**'
- '!docs/**'

pull_request:
branches:
- main
- 'release/*'
- 'support/*'
paths:
- '**'
- '!docs/**'
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: peter-evans/repository-dispatch@v1.1.3
- uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
repository: ${{ github.repository }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
## files generated by popular Visual Studio add-ons.

# User-specific files
.vs
*.suo
*.user
*.userprefs
2 changes: 2 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -2,3 +2,5 @@ assembly-versioning-scheme: MajorMinorPatch
branches:
main:
tag: beta
support:
tag: beta
2 changes: 1 addition & 1 deletion build/build/Tasks/Test/PublishCoverage.cs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ public override bool ShouldRun(BuildContext context)
{
var shouldRun = true;
shouldRun &= context.ShouldRun(context.IsOnWindows, $"{nameof(PublishCoverage)} works only on Windows agents.");
shouldRun &= context.ShouldRun(context.IsOnMainOrReleaseBranchOriginalRepo, $"{nameof(PublishCoverage)} works only for on main or release branch original repository.");
shouldRun &= context.ShouldRun(context.IsOnMainOrSupportBranchOriginalRepo, $"{nameof(PublishCoverage)} works only for on main or release branch original repository.");

return shouldRun;
}
9 changes: 5 additions & 4 deletions build/common/Utilities/BuildContextBase.cs
Original file line number Diff line number Diff line change
@@ -8,8 +8,9 @@ protected BuildContextBase(ICakeContext context) : base(context)
public BuildVersion? Version { get; set; }

public bool IsOriginalRepo { get; set; }
public string BranchName { get; set; } = string.Empty;
public bool IsMainBranch { get; set; }
public bool IsReleaseBranch { get; set; }
public bool IsSupportBranch { get; set; }
public bool IsPullRequest { get; set; }
public bool IsTagged { get; set; }
public bool IsLocalBuild { get; set; }
@@ -18,7 +19,7 @@ protected BuildContextBase(ICakeContext context) : base(context)
public bool IsOnWindows { get; set; }
public bool IsOnLinux { get; set; }
public bool IsOnMacOS { get; set; }
public bool IsOnMainOrReleaseBranchOriginalRepo => !IsLocalBuild && IsOriginalRepo && (IsMainBranch || IsReleaseBranch) && !IsPullRequest;
public bool IsStableRelease => IsOnMainOrReleaseBranchOriginalRepo && IsTagged;
public bool IsPreRelease => IsOnMainOrReleaseBranchOriginalRepo && !IsTagged;
public bool IsOnMainOrSupportBranchOriginalRepo => !IsLocalBuild && IsOriginalRepo && (IsMainBranch || IsSupportBranch) && !IsPullRequest;
public bool IsStableRelease => IsOnMainOrSupportBranchOriginalRepo && IsTagged;
public bool IsPreRelease => IsOnMainOrSupportBranchOriginalRepo && !IsTagged;
}
Loading