Skip to content
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

[Bug] - GitVersion.yml - ignore part ignored #2412

Closed
mirecad opened this issue Sep 28, 2020 · 8 comments · Fixed by #2429
Closed

[Bug] - GitVersion.yml - ignore part ignored #2412

mirecad opened this issue Sep 28, 2020 · 8 comments · Fixed by #2429
Labels
Milestone

Comments

@mirecad
Copy link
Contributor

mirecad commented Sep 28, 2020

Gitversion does not take ignore part of GitVersion.yml into account.

Expected Behavior

We should be able to see ignore settings of GitVersion.yml by running command gitversion /showconfig

Actual Behavior

gitversion /showconfig shows default values for ignore section in GitVersion 5.3.7. (I tested on 5.0.1 and everything was OK)

ignore:
  sha: []

Steps to Reproduce

git init

git commit -m "initial" --allow-empty

cat GitVersion.yml
mode: Mainline
branches: {}
ignore:
  sha: [794454f56b4e7a1867b15bc3834d7169ed01b752]
merge-message-formats: {}

gitversion /showconfig

contains:

ignore:
  sha: []

but should contain:

ignore:
  sha:
  - 794454f56b4e7a1867b15bc3834d7169ed01b752

Your Environment

  • Version Used: 5.3.7+Branch.master.Sha.b22e8726683a0997484b53c5efd54394e93b5306
  • Operating System and version : Windows 10.0.18362.0
  • GitVersion installed by: choco install GitVersion.Portable
@mirecad mirecad added the bug label Sep 28, 2020
@asbjornu
Copy link
Member

I don't know, but this may be a bug in /showconfig and not with ignore itself, as we have tests for this:

[Test]
public void CanDeserialize()
{
var yaml = @"
ignore:
sha: [b6c0c9fda88830ebcd563e500a5a7da5a1658e98]
commits-before: 2015-10-23T12:23:15
";
using var reader = new StringReader(yaml);
var config = ConfigSerializer.Read(reader);
config.Ignore.ShouldNotBeNull();
config.Ignore.ShAs.ShouldNotBeEmpty();
config.Ignore.ShAs.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98" });
config.Ignore.Before.ShouldBe(DateTimeOffset.Parse("2015-10-23T12:23:15"));
}
[Test]
public void ShouldSupportsOtherSequenceFormat()
{
var yaml = @"
ignore:
sha:
- b6c0c9fda88830ebcd563e500a5a7da5a1658e98
- 6c19c7c219ecf8dbc468042baefa73a1b213e8b1
";
using var reader = new StringReader(yaml);
var config = ConfigSerializer.Read(reader);
config.Ignore.ShouldNotBeNull();
config.Ignore.ShAs.ShouldNotBeEmpty();
config.Ignore.ShAs.ShouldBe(new[] { "b6c0c9fda88830ebcd563e500a5a7da5a1658e98", "6c19c7c219ecf8dbc468042baefa73a1b213e8b1" });
}

Are you experiencing that GitVersion is actually not ignoring the specified commit when calculating the version number?

@mirecad
Copy link
Contributor Author

mirecad commented Sep 28, 2020

I just checked. Ignore specific sha is not working for me even on older versions. Older versions show at least correct /showconfig.

You can see bellow, that I put sha of my last commit to ignore section, but version numbers are computed based on this commit.

FYI: I'm using gitversion for the first time.

​D:\working\gitversiontestPS>gitversion -version
5.3.7+Branch.master.Sha.b22e8726683a0997484b53c5efd54394e93b5306

​D:\working\gitversiontestPS>cat .\GitVersion.yml
mode: Mainline
branches: {}
ignore:
  sha: [35b6bec470538f6ecc677babd470da17afd73aae]
merge-message-formats: {}

​D:\working\gitversiontestPS>gitversion
{
  "Major":0,
  "Minor":1,
  "Patch":3,
  "PreReleaseTag":3,
  "PreReleaseTagWithDash":"",
  "PreReleaseLabel":"",
  "PreReleaseNumber":"",
  "WeightedPreReleaseNumber":60000,
  "BuildMetaData":"",
  "BuildMetaDataPadded":"",
  "FullBuildMetaData":"Branch.master.Sha.35b6bec470538f6ecc677babd470da17afd73aae",
  "MajorMinorPatch":"0.1.3",
  "SemVer":"0.1.3",
  "LegacySemVer":"0.1.3",
  "LegacySemVerPadded":"0.1.3",
  "AssemblySemVer":"0.1.3.0",
  "AssemblySemFileVer":"0.1.3.0",
  "FullSemVer":"0.1.3",
  "InformationalVersion":"0.1.3+Branch.master.Sha.35b6bec470538f6ecc677babd470da17afd73aae",
  "BranchName":"master",
  "EscapedBranchName":"master",
  "Sha":"35b6bec470538f6ecc677babd470da17afd73aae",
  "ShortSha":"35b6bec",
  "NuGetVersionV2":"0.1.3",
  "NuGetVersion":"0.1.3",
  "NuGetPreReleaseTagV2":"",
  "NuGetPreReleaseTag":"",
  "VersionSourceSha":"ebc37dd3908db1e5285ad4b228fdc5fc19086a5f",
  "CommitsSinceVersionSource":3,
  "CommitsSinceVersionSourcePadded":"0003",
  "CommitDate":"2020-09-28"
}

​D:\working\gitversiontestPS>git log
commit 35b6bec470538f6ecc677babd470da17afd73aae (HEAD -> master)
Author: Miroslav Adamec <[email protected]>
Date:   Tue Sep 29 00:32:16 2020 +0200

    commit 4

commit ae496287478f79bb7eb9cc8e9017666a3b38010a
Author: Miroslav Adamec <[email protected]>
Date:   Tue Sep 29 00:31:05 2020 +0200

    commit 3

commit a818015a90cd3233590ce31f1cefd3635b11db43
Author: Miroslav Adamec <[email protected]>
Date:   Tue Sep 29 00:30:54 2020 +0200

    commit 2

commit ebc37dd3908db1e5285ad4b228fdc5fc19086a5f
Author: Miroslav Adamec <[email protected]>
Date:   Tue Sep 29 00:30:38 2020 +0200

    commit 1

@senritsu
Copy link

senritsu commented Oct 5, 2020

Can confirm this happens with 5.3.7 dotnet global tool. I have specified both a date, and individual commit hashes. A certain merge still shows up as a version source when running with /output buildserver, despite being both older than the specified date, and excluded by hash specifically.

@sdybvik
Copy link

sdybvik commented Oct 16, 2020

This bug was introduced in 5.3.6.

With this in GitVersion.yml:

ignore:
  commits-before: 2020-09-04T00:00:00

The result when running gitversion /showConfig is this in these versions:

5.3.6:

ignore:
  sha: []

In 5.3.5:

ignore:
  commits-before:
    date-time: 2020-09-04T00:00:00.0000000
    utc-date-time: 2020-09-03T22:00:00.0000000Z
    local-date-time: 2020-09-04T00:00:00.0000000+02:00
    date: 2020-09-04T00:00:00.0000000
    day: 4
    day-of-week: Friday
    day-of-year: 248
    month: 9
    offset: 02:00:00
    ticks: 637347744000000000
    utc-ticks: 637347672000000000
    year: 2020
  sha: []

@asbjornu
Copy link
Member

Thanks for making that discovery, @sdybvik! We'll have to dig through the commit log find the problematic commit then.

@arturcic
Copy link
Member

arturcic commented Oct 19, 2020

@mirecad does this issue fixes also #2354?

@mirecad
Copy link
Contributor Author

mirecad commented Oct 19, 2020

Yes. Fixes also #2354.

@arturcic
Copy link
Member

🎉 This issue has been resolved in version 5.5.0 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants