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

Ungraceful behaviour when opening magit outside of a git repo #162

Closed
ashishnargundkar opened this issue Apr 6, 2018 · 1 comment
Closed

Comments

@ashishnargundkar
Copy link

ashishnargundkar commented Apr 6, 2018

Short description of the problem

With the code in vimagit's master branch, I get the following error message:

magit can not find any git repository
make sure that current opened file or vim current directory points to a git repository
search paths:
.
/Users/apnargundkar
Error detected while processing function magit#show_magit:
line   27:
E605: Exception not caught: magit_not_in_git_repo

I'm not quite familiar with the codebase yet, but here are my two cents. Changing

throw 'magit_not_in_git_repo'
to a simple return not only silences the uncaught exception complaint (E605) but also keeps the upper part of the helpful error message which originates from magit.

==========================================================================

For code in next, the behaviour is slightly different. It gives a poorer error message and also opens a completely blank magit buffer (doesn't happen with master). The error message is:

Error detected while processing function magit#show_magit[61]..magit#git#set_top_dir[3]..magit#utils#chdir:
line    8:
E344: Can't find directory "fatal: Not a git repository (or any of the parent directories): .git/" in cdpath
E472: Command failed

Steps to reproduce

Open vim from a directory which is not part of a git repo and then open vimagit (<leader>M).

Environment

  • vim or nvim version
    VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 30 2018 07:37:16)

  • git version
    git version 2.15.1 (Apple Git-101)

  • current vimagit version or (or SHA1)
    Master: 8c7c012
    Next: f32316d

  • OS
    macOS High Sierra Version 10.13.3

  • terminal or gvim
    iTerm2 + tmux

Thanks for the awesome plugin!

@jreybert
Copy link
Owner

jreybert commented Oct 6, 2018

Thanks for the advice, it is actually a good one.
I just discover you ticket, I don't know how I missed it...

@jreybert jreybert added this to the Release 1.7.3 milestone Oct 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants