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

invalid use of Lazy<GitVersionContext>, #2933 fix doesn't work actualy #2951

Merged
merged 2 commits into from
Mar 5, 2022

Conversation

hyabean
Copy link
Contributor

@hyabean hyabean commented Dec 28, 2021

Description

Fixes #2927

Related Issue

#2927

Motivation and Context

Invalid use of Lazy leads the fix of #2933 doesn't work properly. this.versionContext.Value will always be null. This problem was bypassed by way of early access in unit test.
if replace

        bool isCurrentCommitTagged = this.versionContext.IsValueCreated &&
            this.versionContext.Value.IsCurrentCommitTagged;

with
bool isCurrentCommitTagged = context.IsCurrentCommitTagged;,
will cause many other unit tests failed.
So I have to move the if statement into the NormalizeGitDirectory method.

How Has This Been Tested?

Tested the reproduce case in #2927.
all unit tests passed

Screenshots (if appropriate):

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@hyabean
Copy link
Contributor Author

hyabean commented Dec 28, 2021

@asbjornu #2933 doesn't work because of invalid use of versionContext. So the unit tests passed, but the .exe doesn't work.

@hyabean
Copy link
Contributor Author

hyabean commented Jan 5, 2022

@asbjornu I made a mistake on #2933. So I modify the code again, I'm sure all #2933 is fixed and UT passed. Can you merge this PR?

@asbjornu
Copy link
Member

@asbjornu #2933 doesn't work because of invalid use of versionContext. So the unit tests passed, but the .exe doesn't work.

I'm surprised that isn't picked up by any of our tests. Thoughts @arturcic?

@asbjornu asbjornu requested a review from arturcic March 3, 2022 21:56
@asbjornu
Copy link
Member

asbjornu commented Mar 3, 2022

Could you please rebase this on HEAD of main and resolve conflicts, @hyabean? 🙏🏼

@hyabean
Copy link
Contributor Author

hyabean commented Mar 5, 2022

Could you please rebase this on HEAD of main and resolve conflicts, @hyabean? 🙏🏼

Please go on

Copy link
Member

@asbjornu asbjornu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not comfortable not having tests that exercise the failure you've experienced, but since no existing tests fail, I suppose this should be fine.

@asbjornu asbjornu added this to the 5.x milestone Mar 5, 2022
@asbjornu asbjornu merged commit 12e23f7 into GitTools:main Mar 5, 2022
@mergify
Copy link
Contributor

mergify bot commented Mar 5, 2022

Thank you @hyabean for your contribution!

@hyabean hyabean deleted the fix-2927 branch March 8, 2022 00:35
@arturcic arturcic modified the milestones: 5.x, 5.9.0 Mar 10, 2022
@arturcic arturcic added the bug label Mar 10, 2022
@github-actions
Copy link

🎉 This issue has been resolved in version 5.9.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 this pull request may close these issues.

[Bug]Failed to try and guess branch to use. Move one of the branches along a commit to remove warning
3 participants