Giter Site home page Giter Site logo

Comments (12)

 avatar commented on June 14, 2024 2

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 FileRepositoryBuilder is an ordinary, public, non-deprecated class.

from gradle-android-git-version.

 avatar commented on June 14, 2024

This is good but it break's everyone's favorite git feature: submodules. I'm looking into this.

from gradle-android-git-version.

 avatar commented on June 14, 2024

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.

from gradle-android-git-version.

 avatar commented on June 14, 2024

@Ferrugemm this is now published in 0.4.14; if this doesn't work please let me know or reopen.

from gradle-android-git-version.

lf3rn4nd0f avatar lf3rn4nd0f commented on June 14, 2024

Hey @gladed, thanks for the attention and the upgrades, but still don't working :(

The stacktrace from my machine (Linux 18.04 LTS)

~/AndroidStudioProjects/<project>   <branch>/gladed-plugin ✚  git commit -m "new version of gladed plugin v0.4.14"

1: Task failed with an exception.
-----------
* Where:
Script '/.../<file>.gradle' line: 10

* What went wrong:
A problem occurred evaluating script.
> Bare Repository has neither a working tree, nor an index

I made the modification above and generated the local .jar and it works to me.

from gradle-android-git-version.

 avatar commented on June 14, 2024

Can I reproduce this locally? What kind of a hook is installed?

from gradle-android-git-version.

lf3rn4nd0f avatar lf3rn4nd0f commented on June 14, 2024

Yes, you can!

It is pre-commit hooks and basically make auto check of my project.
This article drives the setup process: https://medium.com/@alistair.cerio/android-ktlint-and-pre-commit-git-hook-5dd606e230a9

Besides that, i've your plugin configured in app/build.gradle, with .name and the .code.

from gradle-android-git-version.

 avatar commented on June 14, 2024

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

from gradle-android-git-version.

lf3rn4nd0f avatar lf3rn4nd0f commented on June 14, 2024

@gladed yes, it is my local machine and repo :(

How can i verify the not bare repository?

from gradle-android-git-version.

 avatar commented on June 14, 2024

https://stackoverflow.com/questions/1830701/how-do-i-check-if-a-repository-is-bare

from gradle-android-git-version.

lf3rn4nd0f avatar lf3rn4nd0f commented on June 14, 2024

From my .sh and terminal:

$ git rev-parse --is-bare-repository

The result is false

from gradle-android-git-version.

lf3rn4nd0f avatar lf3rn4nd0f commented on June 14, 2024

Thanks @gladed 😄

from gradle-android-git-version.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.