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

git version 2.13.0 error when not in git directory #110

Closed
yifan opened this issue May 11, 2017 · 10 comments
Closed

git version 2.13.0 error when not in git directory #110

yifan opened this issue May 11, 2017 · 10 comments
Assignees
Labels
Milestone

Comments

@yifan
Copy link

yifan commented May 11, 2017

I just updated git with homebrew. The new git will print error message related to this commit:
git/git@b1ef400

Now I keep getting this fatal: BUG: setup_git_env called without repository message for every command and directory in my terminal.

@jawshooah
Copy link

I've reported the issue to the Git mailing list and a patch is in the works, as BUG assertions should never happen in the wild, but oh-my-git probably shouldn't be calling git config --local outside of a Git repository to begin with.

@massar
Copy link

massar commented May 16, 2017

Simply redirecting the error to /dev/null and at least it is not confusingly (as one might think it is the command you run, instead of the prompt :) ) popping up that error all the time.

diff:

diff --git a/base.sh b/base.sh
index 5be07b3..d49c573 100644
--- a/base.sh
+++ b/base.sh
@@ -49,7 +49,7 @@ function get_current_action () {
 }

 function build_prompt {
-    local enabled=`git config --local --get oh-my-git.enabled`
+    local enabled=`git config --local --get oh-my-git.enabled 2>/dev/null`
     if [[ ${enabled} == false ]]; then
         echo "${PSORG}"
         exit;

Also some wee little background from https://github.com/blog :

The last few versions of Git have cleaned up many corner cases around repository discovery and initialization. As a final step in that work, Git 2.13 introduced a new assertion to catch any cases that were missed. After being tested for months in development versions, this shouldn't trigger. But it's possible that you may see BUG: setup_git_env called without repository. If you do, please consider making a bug report. [source]

and other people are reporting issues as well:
https://www.spinics.net/lists/git/msg303775.html

@sw0x2A
Copy link

sw0x2A commented May 18, 2017

I think better solution is to simply drop --local. git-config will skip repo-level config if it is not in a repo and fatal is not triggered.

@Casyfill
Copy link

tried, but both suggestions didn't work for me.
do I need to reinstall the plugin somehow after changing the base.sh?

@florinpatrascu
Copy link

@Casyfill - for me it worked after reloading ~/.profile HTH

@huxi
Copy link

huxi commented Jun 26, 2017

Message changed from fatal: BUG: setup_git_env called without repository (2.13.1) to fatal: --local can only be used inside a git repository (2.13.2).

@cy4n
Copy link
Contributor

cy4n commented Jun 27, 2017

there's additional value to removing the --local instead of skipping the error:
#109 (comment)

@macropin
Copy link

Just hit this with the latest Xcode 9.0 update which ships git version 2.13.5 (Apple Git-94).

@macropin
Copy link

Looks like there is a PR for this #109

@arialdomartini arialdomartini self-assigned this Oct 4, 2017
@arialdomartini arialdomartini added this to the v1.6 milestone Oct 4, 2017
@arialdomartini
Copy link
Owner

@yifan, @jawshooah, @massar, @sw0x2A, @Casyfill, @florinpatrascu, @huxi, @macropin

thank you very much to you all! I'm closing this issue, since #109, which fixed the problem, has been merged to master. Grazie mille!

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

No branches or pull requests

10 participants