Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

One of setGitDir or setWorkTree must be called #228

Closed
criztovyl opened this issue Nov 20, 2016 · 15 comments
Closed

One of setGitDir or setWorkTree must be called #228

criztovyl opened this issue Nov 20, 2016 · 15 comments
Labels
Milestone

Comments

@criztovyl
Copy link

criztovyl commented Nov 20, 2016

An exception occurred applying plugin request [id: 'org.ajoberstar.grgit', version: '1.6.0']
> Failed to apply plugin [id 'org.ajoberstar.grgit']
   > One of setGitDir or setWorkTree must be called.

I re-rerun with --stacktrack, which leads to org.ajoberstar.gradle.git.base.GrgitPlugin#apply

Caused by: java.lang.IllegalArgumentException: One of setGitDir or setWorkTree must be called.

I think jgit changed the exception thrown if the no Git repo is found.

Will attach full stacktrace soon. Done.

@criztovyl
Copy link
Author

stacktrace.txt

@ajoberstar
Copy link
Owner

Yeah, that seems pretty likely. I'll mark this a bug and double-check that. Thanks for reporting.

@ajoberstar ajoberstar added the bug label Nov 20, 2016
@ajoberstar ajoberstar modified the milestones: 1.7.0, 1.8.0 Nov 20, 2016
@criztovyl
Copy link
Author

I'll make a PR :)

@criztovyl
Copy link
Author

@criztovyl
Copy link
Author

The Exception seems to come from here: org.ajoberstar.grgit.operation.OpenOp#call

@criztovyl
Copy link
Author

Maybe there should be a final getGitDir() check after builder.findGitDir().

@criztovyl
Copy link
Author

So, this seems to be a grgit issue, not gradle-git, I'll move there :)

@ajoberstar
Copy link
Owner

Reopening since I need to depend on the fixed grgit version.

@jessiepoquerusse
Copy link

I'm still encountering the same issue as criztovyl on 11/20/16. I'm confused about what the consensus for resolution was..?

@criztovyl
Copy link
Author

criztovyl commented Oct 31, 2017

Sorry for my mess of issues and pr's.
The resolution done by ajoberstar/grgit#129 should be in mainline now.
What's your gradle-git version? :)

@jessiepoquerusse
Copy link

This version: https://github.com/ajoberstar/gradle-git
With Gradle 2.10 :)

@ajoberstar
Copy link
Owner

ajoberstar commented Nov 2, 2017

This fix was added in v1.7.2 of grgit (which is a dependency of gradle-git), so it should be fixed in gradle-git 1.7.0 or higher.

If you're using classic syntax plugins:

buildscript {
  // ... repositories ...
  dependencies {
    classpath 'org.ajoberstar:gradle-git:1.7.0' // or higher
  }
}

If you're using plugin block:

plugins {
  id 'org.ajoberstar.grgit' version '1.7.0' // or higher
}

Though I recommend getting to the latest version you can.

@langsmith
Copy link

langsmith commented Jul 23, 2018

@ajoberstar , I bumped my version to 2.3.0 in mapbox/mapbox-android-demo#786 to get rid of the One of setGitDir or setWorkTree must be called error. Now I'm getting the Error:No .git directory found! error. Is this something wrong on my end or something going on with this Git plugin?

@ajoberstar
Copy link
Owner

The grgit 2.x and beyond plugin is hosted in grgit. Could you open an issue over there and include the full stacktrace you're seeing?

@langsmith
Copy link

Ok, will do @ajoberstar . Thanks

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

No branches or pull requests

4 participants