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

Doesn't work with git worktrees #19

Open
fredfp opened this issue Mar 7, 2018 · 4 comments
Open

Doesn't work with git worktrees #19

fredfp opened this issue Mar 7, 2018 · 4 comments

Comments

@fredfp
Copy link

fredfp commented Mar 7, 2018

Problem from upstream: sbt/sbt-git#110

see also sbt/sbt#2323

@agemooij
Copy link
Owner

agemooij commented Mar 7, 2018

Thanks for reporting this. I had never heard of Git worktrees so this is all new to me.

What exactly breaks? Does the plugin crash or produce stacktraces?
Do you have any suggestions on what should happen in such situations?
What kind of information would you like the Git promptlet to show in your prompt?

@agemooij
Copy link
Owner

agemooij commented Mar 7, 2018

I read a few of the bug reports and it seems that we could just depend on command line Git instead of sbt-git.

Is this in any way urgent for you?

@fredfp
Copy link
Author

fredfp commented Mar 7, 2018

It is not urgent, thank you. I just wanted you to know, sorry I included so little details, here's more.

Using sbt-prompt, and starting sbt from a git worktree, sbt fails to load and crashes with a stacktrace:

[error] org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
[error] at org.eclipse.jgit.lib.Repository.getWorkTree(Repository.java:1379)
[error] at org.eclipse.jgit.treewalk.FileTreeIterator.(FileTreeIterator.java:115)
[error] at org.eclipse.jgit.treewalk.FileTreeIterator.(FileTreeIterator.java:97)
[error] at org.eclipse.jgit.api.StatusCommand.call(StatusCommand.java:139)
[error] at com.typesafe.sbt.git.JGit.hasUncommittedChanges(JGit.scala:88)
[error] at com.typesafe.sbt.SbtGit$.$anonfun$buildSettings$20(SbtGit.scala:121)
[error] at com.typesafe.sbt.SbtGit$.$anonfun$buildSettings$20$adapted(SbtGit.scala:121)
[error] at com.typesafe.sbt.git.DefaultReadableGit.withGit(ReadableGit.scala:39)
[error] at com.typesafe.sbt.SbtGit$.$anonfun$buildSettings$19(SbtGit.scala:121)
[error] at com.typesafe.sbt.SbtGit$.$anonfun$buildSettings$19$adapted(SbtGit.scala:121)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:219)
[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] org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

The problem comes from JGit, which is used by sbt-git, which sbt-prompt is using.

Other projects seem to get rid of sbt-git altogether as there seem to be no hope that JGit gets fixed anytime soon (a patch for the problem exists since a few years, but never got merged).

This issue is only about fixing the crash.

@agemooij
Copy link
Owner

agemooij commented Mar 8, 2018

Thanks. It seems the mere presence of sbt-git is causing this since there is no mention of sbt-prompt in the stacktrace. Moving to straight commandline git (and dealing with that not being available) seems like the best way to deal with this.

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

2 participants