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

Implemented the Dirty flag #2423

Merged
merged 9 commits into from
Oct 23, 2020
Merged

Conversation

pysco68
Copy link
Contributor

@pysco68 pysco68 commented Oct 13, 2020

Have been replacing a bunch of usages of the deprected Fody.Stamp with GitVersion lately and found that we need the "Dirty" flag as some others (see #1198). Just got ahead and implemented it.

Hope it'll meet the required project standards ;)

Description

Added a variable RepositoryDirtyFlag which is either null or Dirty to be able to add that suffix to my version strings.

Related Issue

As mentioned above: fixes #1198

Motivation and Context

How Has This Been Tested?

I added four test cases which test the behavior of the dirty flag in /src/GitVersionCore.Tests/IntegrationTests/OtherScenarios.cs.

It should be set when there's any non-ignored change vs the HEAD of the repo (that includes staged files).

Other than that I had to change a some other test cases which work on the outputed data to make them work again

Screenshots (if appropriate):

Checklist:

  • My code follows the code style of this project. (hope so :))
  • 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. (I had a bug in a subset of the tests for the netcoreapp2.1 build which seemed to be related to some specifics on my env)

@arturcic
Copy link
Member

@asbjornu can you review this one as well?

@arturcic arturcic added this to the 5.5.0 milestone Oct 19, 2020
docs/input/docs/more-info/variables.md Outdated Show resolved Hide resolved
src/GitVersionCore/Core/RepositoryMetadataProvider.cs Outdated Show resolved Hide resolved
@pysco68
Copy link
Contributor Author

pysco68 commented Oct 23, 2020

@asbjornu looks like the test image for the failed one couldn't fetch the repo from github.com for some reason. Name-resolution perhaps?

@arturcic
Copy link
Member

@asbjornu looks like the test image for the failed one couldn't fetch the repo from github.com for some reason. Name-resolution perhaps?

fixed

@asbjornu asbjornu merged commit afbb8a4 into GitTools:master Oct 23, 2020
@asbjornu
Copy link
Member

Excellent, thank you so much for your contributions @pysco68! 🙏

@pysco68
Copy link
Contributor Author

pysco68 commented Oct 26, 2020

Happy I could help :)

@arturcic
Copy link
Member

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

Your GitReleaseManager bot 📦🚀

arturcic pushed a commit that referenced this pull request Oct 27, 2020
Merge pull request #2423 from pysco68/feature/repo-dirty-flag

Implemented the Dirty flag
@LazaroOnline
Copy link
Contributor

Hello, I can't find how to use the dirty flag.
I don't find it at:
https://gitversion.net/docs/
I'm trying in the GitVersion.yml file to add something like:

assembly-informational-format: 'git-{ShortSha}-{BranchName}--{CommitDate}-{RepositoryDirtyFlag}'

but no luck. Any help/doc/reference?

@asbjornu
Copy link
Member

asbjornu commented Dec 4, 2020

@LazaroOnline, the description in the PR does not reflect what was implemented. The property changed name to UncommittedChanges and its type is an integer indicating the number of uncommitted changes. A PR that updates the docs would be highly appreciated. 🙏

@LazaroOnline
Copy link
Contributor

Under the new name UncommittedChanges it is already in the API docs:
https://gitversion.net/api/GitVersion/SemanticVersionBuildMetaData/
https://gitversion.net/api/GitVersion/SemanticVersionBuildMetaData/4EEF3F34
https://gitversion.net/docs/more-info/variables

The only missing part I think would be at:
https://gitversion.net/docs/configuration
with a small description.

It is nice to have this new variable, however in my case I miss some additional features related to it,
like uncommitted file filters to exclude files from being counted inUncommittedChanges,
because some files may get changed during build or that doesn't affect the resulting DLL, for example:
".txt",
"
.md",
".config",
"
.json",
".js",
"
.css",
...

@asbjornu
Copy link
Member

asbjornu commented Dec 5, 2020

The only missing part I think would be at: https://gitversion.net/docs/configuration with a small description.

Yes, that would be a nice addition.

It is nice to have this new variable, however in my case I miss some additional features related to it, like uncommitted file filters to exclude files from being counted inUncommittedChanges, because some files may get changed during build or that doesn't affect the resulting DLL,

It sounds like if .gitignore was taken into account, that should solve your use-case. And I can agree that would be useful. But we are basing the implementation on what LibGit2Sharp exposes and it's out of scope to do anything about .gitignore in GitVersion. If you figure out a way to do this with LibGit2Sharp, a PR is welcome.

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

Successfully merging this pull request may close these issues.

dirty flag?
4 participants