-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Support omitting the commit count #65
Conversation
We handle a negative `commitCountPad` value as request to not render the commit count at all. That way, we can render Maven SNAPSHOT versions with the following format call: ```scala .format(dirtyHashDigits = 0, commitCountPad = -1, countSep = "-SNAPSHOT", dirtySep = "", revHashDigits = 0, revSep = "") ```
0175eb9
to
d72b19a
Compare
@@ -24,7 +24,7 @@ case class VcsState( | |||
val commitCountPart = if (lastTag.isEmpty || commitsSinceLastTag > 0) { | |||
s"$countSep${if (commitCountPad > 0) { | |||
(10000000000000L + commitsSinceLastTag).toString().substring(14 - commitCountPad, 14) | |||
} else commitsSinceLastTag}" | |||
} else if (commitCountPad == 0) commitsSinceLastTag else ""}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with this change the revisionPart
will still come after it won't it? So if
- tag 0.1.0
- commit twice
- wouldn't this produce 0.1.0-SNAPSHOT_revisionPart_
If so, that'd be what I'm trying to avoid. According to sonatype snapshots the version has to end with -SNAPSHOT
in order to be published.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more context, my goal is this https://github.com/ckipp01/mill-ci-release/actions/workflows/release.yml
Release a snapshot for every merge into main. I'm hacking it now, but the way my versions looks here is what I'd want: 0.1.1-2-16b374-SNAPSHOT
for example. So that every one is unique and ends in -SNAPSHOT
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, then a completely misunderstood your request. To my (probably outdated) knowledge, Maven is handling -SNAPSHOT dependencies specially when deploying to a remote repository, by replacing the SNAPSHOT suffix with a timestamp.
But now I see, that you don't want to rely on that mechanism, but instead just want to append the -SNAPSHOT
. I think the -SNAPSHOT
suffix was initially only intended to be used in local repositories, but it looks like it is nowadays commonly used, so yeah, we can also implement that.
I think we still want to keep the essential change of this PR, omitting the count.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
We handle a negative
commitCountPad
value as request to not render the commit count at all.