-
Notifications
You must be signed in to change notification settings - Fork 29
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
Bare Repository has neither a working tree, nor an index via execution of git hooks #87
Comments
This is good but it break's everyone's favorite git feature: submodules. I'm looking into this. |
I think the real problem above may be that some aspect of your hooks is operating without access to the .git tree, causing RepositoryNotFoundException which is not caught. In this case, androidGitVersion can print a warning message and continue. |
@Ferrugemm this is now published in 0.4.14; if this doesn't work please let me know or reopen. |
Hey @gladed, thanks for the attention and the upgrades, but still don't working :( The stacktrace from my machine (Linux 18.04 LTS)
I made the modification above and generated the local .jar and it works to me. |
Can I reproduce this locally? What kind of a hook is installed? |
Yes, you can! It is pre-commit hooks and basically make auto check of my project. Besides that, i've your plugin configured in |
Here's what I did, and it worked. Are you sure the repo you're working from is present and not bare? Or is this a result you're only getting from CI on a server? $ cat >.git/hooks/pre-commit
#!/bin/bash
git stash -q --keep-index
./gradlew androidGitVersion
RESULT=$?
git stash pop -q
# return 1 exit code if running checks fails
[ $RESULT -ne 0 ] && exit 1
exit 0
^D
$ chmod a+x .git/hooks/pre-commit
$ git commit -m "temp" --allow-empty
...
> Task :...:androidGitVersion
androidGitVersion.name 1.2.3
androidGitVersion.code 1002003
BUILD SUCCESSFUL in 1s
5 actionable tasks: 5 executed
[master 98c6276f] temp |
@gladed yes, it is my local machine and repo :( How can i verify the not bare repository? |
From my .sh and terminal:
The result is false |
Then there must be something else wrong on your local setup. jgit appears to be reporting that it cannot find your working file tree. Note that the implementation in this project matches published jgit documentation and |
Thanks @gladed 😄 |
When execute the assemble task via git hooks with the plugin androidGitVersion configured, the build was failed.
Searching the web, i found this ask:
Jgit:Bare Repository has neither a working tree, nor an index
@mincong answer this:
Opening a Git repository using FileRepositoryBuilder is tricky. This is an internal class. Its method setGitDir(File) defines the location of the repository metadata (the .git folder). In other words, it is used to construct a Git bare repository.
Suggestions of implementation:
Before:
After:
Link: https://stackoverflow.com/questions/49282593/jgitbare-repository-has-neither-a-working-tree-nor-an-index
The text was updated successfully, but these errors were encountered: