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

Improved error message and FP style #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/main/scala/ReleaseExtra.scala
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,15 @@ object ReleaseStateTransformations {
IO.writeLines(file, Seq(versionString))
}

private[sbtrelease] lazy val initialVcsChecks = { st: State =>
val status = (vcs(st).status !!).trim
if (status.nonEmpty) {
sys.error("Aborting release. Working directory is dirty.")
lazy val initialVcsChecks = (st: State) =>
if ((vcs(st).status !!).trim.nonEmpty)
sys.error("Aborting release. Working directory has uncommitted changes, " +
"please commit your changes before running this command.")
Copy link

Choose a reason for hiding this comment

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

user can also stash or revert. committing is just one way to solve it
also i remember there were talks about allowing release to continue even wit dirty wd when some setting is set to true

else {
st.log.info("Starting release process off commit: " + vcs(st).currentHash)
st
}

st.log.info("Starting release process off commit: " + vcs(st).currentHash)
st
}

lazy val commitReleaseVersion = ReleaseStep(commitReleaseVersionAction, initialVcsChecks)
private[sbtrelease] lazy val commitReleaseVersionAction = { st: State =>
val newState = commitVersion(st)
Expand Down