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

Project load failure on git describe abbrev failure #117

Open
ignasi35 opened this issue Jul 18, 2019 · 3 comments
Open

Project load failure on git describe abbrev failure #117

ignasi35 opened this issue Jul 18, 2019 · 3 comments

Comments

@ignasi35
Copy link
Contributor

ignasi35 commented Jul 18, 2019

sbt-dynver uses git describe --abbrev=8 and the pattern matches on exactly 8 characters for the abbreviated SHA-1.

git describe --abbrev=<n> produces a shortened representation of the SHA-1 of at least n.

sbt-dynver causes a MatchError whenever the abbreviated SHA-1 is longer than 8:

[info] Loading settings for project root from build.sbt ...
[info] Resolving key references (69692 settings) ...
[error] scala.MatchError: 1.6.0-M4+51-8dc64459f+20190718-1826
[error]  (of class java.lang.String)
[error]         at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:255)
[error]         at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:253)
[error]         at sbtdynver.GitDescribeOutput$Parser$$anonfun$parse$1.applyOrElse(DynVerPlugin.scala:145)
[error]         at sbtdynver.GitDescribeOutput$Parser$$anonfun$parse$1.applyOrElse(DynVerPlugin.scala:145)
[error]         at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:34)
[error]         at scala.Option.map(Option.scala:146)
[error]         at sbtdynver.DynVer.getGitDescribeOutput(DynVerPlugin.scala:210)
[error]         at sbtdynver.DynVerPlugin$.$anonfun$buildSettings$7(DynVerPlugin.scala:50)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:221)
[error]         at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:164)
[error]         at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
[error]         at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:98)
[error]         at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] scala.MatchError: 1.6.0-M4+51-8dc64459f+20190718-1826
[error]  (of class java.lang.String)
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 

which can be reproduced using this commit (NOTE: the link is now broken because I rebased but I kept the commit reproducing the error here).

The workaround is to amend the commit to get a different SHA-1 so the hash collision resolves.

@dwijnand
Copy link
Member

@johanandren
Copy link

johanandren commented Apr 28, 2020

Just got hit by this one as well. (Thanks for writing down what to do about it or I would have spent the day 🙇 )

@davidcorcoran
Copy link

(Seeing this in sbt-synver 4.0.0 and 4.1.1)

Just hit this one too. You can see the abbreviated git hash (0147e8bb2) is 9 characters.

$ git describe --tags --abbrev=8
v1.11.1-2-g0147e8bb2

So running sbt produces this stack trace:

scala.MatchError: v1.11.1+2-0147e8bb2
 (of class java.lang.String)
        at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:259)
        at scala.PartialFunction$$anon$1.apply(PartialFunction.scala:257)
        at sbtdynver.GitDescribeOutput$Parser$$anonfun$parse$1.applyOrElse(DynVerPlugin.scala:145)
        at sbtdynver.GitDescribeOutput$Parser$$anonfun$parse$1.applyOrElse(DynVerPlugin.scala:145)
        at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:38)
        at scala.Option.map(Option.scala:230)
        at sbtdynver.DynVer.getGitDescribeOutput(DynVerPlugin.scala:210)
        at sbtdynver.DynVerPlugin$.$anonfun$buildSettings$7(DynVerPlugin.scala:50)
        at scala.Function1.$anonfun$compose$1(Function1.scala:49)
        at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:228)
        at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:170)
        at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
        at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:99)
        at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
[error] scala.MatchError: v1.11.1+2-0147e8bb2

@ignasi35 thanks for figuring it out. Saved me a lot of time...

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

No branches or pull requests

4 participants