sbt / sbt-git

A git plugin for sbt
BSD 2-Clause "Simplified" License
347 stars 102 forks source link

sbt-git v2.0.1 disables all ouput from git commands to sbt logs #234

Open seigert opened 1 year ago

seigert commented 1 year ago

Steps to reproduce:

$ (~) > mkdir sbt-git-test && cd sbt-git-test 

$ (~/sbt-git-test ) > git init
Initialized empty Git repository in ~/junk/.git/

$ (~/sbt-git-test ) > mkdir project

$ (~/sbt-git-test ) > echo "sbt.version = 1.8.2" > project/build.properties

$ (~/sbt-git-test ) > echo 'addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.0")' > project/plugins.sbt

$ (~/sbt-git-test ) > sbt
[info] welcome to sbt 1.8.2 (Homebrew Java 11.0.17)
...
[info] started sbt server
sbt:sbt-git-test> git status
[info] On branch master
[info] No commits yet
[info] Untracked files:
[info]   (use "git add <file>..." to include in what will be committed)
[info]  .bsp/
[info]  project/
[info]  target/
[info] nothing added to commit but untracked files present (use "git add" to track)
sbt:sbt-git-test>
[info] shutting down sbt server

$ (~/sbt-git-test ) > echo 'addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")' > project/plugins.sbt

$ (~/sbt-git-test ) > sbt
[info] welcome to sbt 1.8.2 (Homebrew Java 11.0.17)
...
[info] started sbt server
sbt:sbt-git-test> git status
sbt:sbt-git-test> git log -1
[error] fatal: your current branch 'master' does not have any commits yet
[error] Nonzero exit code (128) running git.
sbt:sbt-git-test> set logLevel := Level.Debug
[info] Defining logLevel
[info] The new value will be used by Test / test / testListeners, Test / testOnly / testListeners and 5 others.
[info]  Run `last` for details.
[info] Reapplying settings...
[info] set current project to sbt-git-test (in build file:/Users/a.shuksto/Projects/junk/sbt-git-test/)
sbt:sbt-git-test> git status
sbt:sbt-git-test>

As you can see, running git commands from SBT w/o any visual cconfirmation is very inconvenient...

reid-spencer commented 11 months ago

Confirmed. I've been experiencing this too. I wonder if this has to do with I/O work within sbt in some version after sbt 1.5 ? This same lack of output from git commands happens for me with any sbt 1.9 version

rayrobdod commented 11 months ago

sbt-git 2.0.0 on sbt 1.9.7 will produce output, while sbt-git 2.0.1 on sbt 1.9.7 will not produce output. Which leads me to think that io work within sbt is not relevant. I want to blame #219 , but even sbt --debug git status will not produce output, and it should if the only change was that the git command log output was changed from info to debug.

reid-spencer commented 11 months ago

@rayrobdod - If that's the case then it should be pretty simple to track down the change producing no output: compare 2.0.0 with 2.0.1. I'm going to do this shortly and see if I can find a solution just on visual inspection of the delta.

reid-spencer commented 11 months ago

I've tested that assertion about sbt 1.9.7 with 2.0.0 producing output and 2.0.1 not producing output. That assertion doesn't hold for me. Neither 2.0.0 nor 2.0.1 produced output with sbt 1.97 in my project.

reid-spencer commented 11 months ago

I've tested that assertion about sbt 1.9.7 with 2.0.0 producing output and 2.0.1 not producing output. That assertion doesn't hold for me. Neither 2.0.0 nor 2.0.1 produced output with sbt 1.97 in my project.

That was a mistake. I had a build error that was still pulling in 2.0.1. I can confirm now that 2.0.0 does produce output.