Nerdbank.gitversioning: Add dirty flag to GitCommitId and AssemblyInformationalVersion

Created on 19 May 2020  路  1Comment  路  Source: dotnet/Nerdbank.GitVersioning

I am in the situation where some test builds are done (incorrectly) with changes that have not been committed. Thus relying on the GitCommitId will not reproduce the same build. Is it possible to add a -dirty flag to the GitCommitId and AssemblyInformationalVersion so that those builds can at least be identified as not reproducible from their git commit?

enhancement help wanted

Most helpful comment

That sounds like a good idea. Since some repos actually deliberately dirty their git repo during the build (e.g. to stamp package.json) I think we'd want to make the dirty flag have an opt-out (or maybe even an opt-in).

There's one other gotcha, which is that the libgit2sharp version we're currently using actually falsely claims dirty repos because of a temporary file it creates. See #396. I suspect we should fix that before implementing this feature or else we'll get more bugs of "My binary says it came from a dirty repo but it didn't."

>All comments

That sounds like a good idea. Since some repos actually deliberately dirty their git repo during the build (e.g. to stamp package.json) I think we'd want to make the dirty flag have an opt-out (or maybe even an opt-in).

There's one other gotcha, which is that the libgit2sharp version we're currently using actually falsely claims dirty repos because of a temporary file it creates. See #396. I suspect we should fix that before implementing this feature or else we'll get more bugs of "My binary says it came from a dirty repo but it didn't."

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tobias-Gr picture Tobias-Gr  路  3Comments

hypervtechnics picture hypervtechnics  路  6Comments

bradwilson picture bradwilson  路  11Comments

rgmills picture rgmills  路  11Comments

AArnott picture AArnott  路  4Comments