diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf961279d..f44285812 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,5 +85,7 @@ jobs: 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" + diff --git a/LibGit2Sharp.Tests/GlobalSettingsFixture.cs b/LibGit2Sharp.Tests/GlobalSettingsFixture.cs index e067fd192..cd237663e 100644 --- a/LibGit2Sharp.Tests/GlobalSettingsFixture.cs +++ b/LibGit2Sharp.Tests/GlobalSettingsFixture.cs @@ -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 = @"^(?\d+\.\d+\.\d+(-[\w\-\.]+)?\+((?[a-f0-9]{10})\.)?libgit2-[a-f0-9]{7}) \((?\w+) - (?(?:\w*(?:, )*\w+)*)\)$"; + string regex = @"^(?\d+\.\d+\.\d+(-[\w\-\.]+)?)\+libgit2-[a-f0-9]{7}\.((?[a-f0-9]{40}))? \((?\w+) - (?(?:\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."); } diff --git a/LibGit2Sharp.sln b/LibGit2Sharp.sln index a81b0ce37..e99eec26f 100644 --- a/LibGit2Sharp.sln +++ b/LibGit2Sharp.sln @@ -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 @@ -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}" diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 0b88a3af5..6aa70519c 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -17,6 +17,8 @@ square-logo.png App_Readme/LICENSE.md true + preview.0 + libgit2-$(libgit2_hash.Substring(0,7)) @@ -32,15 +34,15 @@ - + - + - https://github.com/libgit2/libgit2sharp/blob/$(GitCommitIdShort)/CHANGES.md#libgit2sharp-changes + https://github.com/libgit2/libgit2sharp/blob/$(SourceRevisionId)/CHANGES.md diff --git a/LibGit2Sharp/Version.cs b/LibGit2Sharp/Version.cs index 3795382a3..2c21ccad2 100644 --- a/LibGit2Sharp/Version.cs +++ b/LibGit2Sharp/Version.cs @@ -1,4 +1,5 @@ using System.Globalization; +using System.Reflection; using LibGit2Sharp.Core; namespace LibGit2Sharp @@ -22,7 +23,14 @@ internal static Version Build() /// /// Returns version of the LibGit2Sharp library. /// - public virtual string InformationalVersion => ThisAssembly.AssemblyInformationalVersion; + public virtual string InformationalVersion + { + get + { + var attribute = Assembly.GetExecutingAssembly().GetCustomAttribute(); + return attribute.InformationalVersion; + } + } /// /// Returns all the optional features that were compiled into @@ -55,7 +63,7 @@ private string RetrieveAbbrevShaFrom(string sha) /// /// /// The format of the version number is as follows: - /// 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) /// /// public override string ToString() diff --git a/Targets/CodeGenerator.targets b/Targets/CodeGenerator.targets index 249cd4f38..16eb8f05b 100644 --- a/Targets/CodeGenerator.targets +++ b/Targets/CodeGenerator.targets @@ -1,22 +1,24 @@  - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - + $(IntermediateOutputPath)SourceRevisionId.txt $(IntermediateOutputPath)UniqueIdentifier.g.cs $(IntermediateOutputPath)AssemblyCommitIds.g.cs + + + + + + - - + - $([System.Guid]::NewGuid()) - $(GitCommitId) + $(SourceRevisionId) + $([System.Guid]::NewGuid()) namespace LibGit2Sharp.Core { @@ -34,24 +36,12 @@ - - - - - - - - - - - - - + - unknown - $(GitCommitId) + $(SourceRevisionId) + unknown namespace LibGit2Sharp { @@ -70,7 +60,6 @@ - diff --git a/Targets/GenerateNativeDllName.targets b/Targets/GenerateNativeDllName.targets index 244b707b4..c74dcd31e 100644 --- a/Targets/GenerateNativeDllName.targets +++ b/Targets/GenerateNativeDllName.targets @@ -1,9 +1,5 @@  - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - $(IntermediateOutputPath)NativeDllName.g.cs @@ -30,4 +26,5 @@ + diff --git a/version.json b/version.json deleted file mode 100644 index b0cb8c411..000000000 --- a/version.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "0.27.0-preview.{height}", - "publicReleaseRefSpec": [ - "^refs/heads/master$", // we release out of master - "^refs/heads/maint/v\\d+(?:\\.\\d+)?$" // and maint/vNN branches - ], - "cloudBuild": { - "buildNumber": { - "enabled": true - } - } -}