vim-twiggy icon indicating copy to clipboard operation
vim-twiggy copied to clipboard

"Not a git repository" Error

Open AndrewCSQ opened this issue 6 years ago • 23 comments

Trying to use what looks like a fantastic plugin, running into some issues

System Information

  • OS: Linux (Fedora 30)
  • Vim: Neovim (0.3.6)
  • Terminal: Kitty and Konsole
  • Plugin Manager: Plug

Replication

  • cd to home directory
  • mkdir Test2 (any random directory)
  • cd Test2
  • git init (to initialize it as a git repository)
  • run :Twiggy, returns "Not a git repository", the Twiggy panel says 'merge in progress', when aborted, says "/bin/bash: -c: line 0: unexpected EOF while looking for matching `'' " and "syntax error: unexpected end of file"

I have removed all other plugins and theming (keeping only fugitive and vim-twiggy) to eliminate other possible causes.

Issue also persists when I try to clone my own GitHub repos (freshly made and existing projects)

AndrewCSQ avatar Jun 22 '19 14:06 AndrewCSQ

Oh my! What version of git are you using?

sodapopcan avatar Jun 22 '19 15:06 sodapopcan

2.21 it's strange because I recall it worked for just the briefest moment (and in that brief moment was some pretty awesome stuff) and then it went back to not working. I'm kind of new to (neo)vim (but not to programming as a whole), so I'm sorry that I'm taking up your time with a debugging request

AndrewCSQ avatar Jun 22 '19 15:06 AndrewCSQ

Oh, not at all! 'tis the nature of open source :) I'm actually working on twiggy today so it's especially no problem.

There have been some plumbing changes recently that have caused a few issues for some folks. Unfortunately, I dev on a mac so I can't reproduce your set up exactly but I'll see what I can do.

sodapopcan avatar Jun 22 '19 15:06 sodapopcan

Would you mind cloning twiggy, checkout 20cdca4 of this copy then point Plug to it and restart nvim? This was the last commit before I started to make some deeper changes. It doesn't really seem like it should cause this type of error, but it would be nice to rule it out.

Also, do you have Vim 8 on your machine? Is it the same problem if you do?

Also, thank you for your kind words! So sorry it's not working for you.

sodapopcan avatar Jun 22 '19 15:06 sodapopcan

Under neovim, the issue persists even with the given commit. Either "Not a git repository" or the same EOF errors as above.

Under vim (both master and the commit mentioned) I get: Error detected while processing twiggy#Branch[14]..<SNR>28_Render[39]..<SNR>28_no_commits[1]..<SNR>28_git_cmd[6]..<SNR>28_system: line 11: E484: Can't open file /tmp/vvDbu4G/0

I suspect they stem from the same issue.

AndrewCSQ avatar Jun 22 '19 19:06 AndrewCSQ

Interesting! Thank you so much for taking the time to do that.

Do you mind letting me know what the output of this vim command is:

:echo systemlist('git rev-list -n 1 --all | wc -l')

There are some warnings regarding the use of system() in the docs and I have noticed that many of tpope's plugins have a custom shellescape() function and I've never known the reason. When I blindly copy said function from vim-dispatch and apply it to all commands, I actually get an error similar to yours! I'm gonna dig in a little more. It seems like it's a system and/or shell thing.

sodapopcan avatar Jun 22 '19 20:06 sodapopcan

The vim output is ['1'] I've heard the vim issue mentioned by a different issue on your repo, setting shell=/bin/bash has no effect (as expected on a Fedora system where it is the default shell anyway.

AndrewCSQ avatar Jun 22 '19 20:06 AndrewCSQ

Yeah, I'm thinking it's more of a system issue than a shell issue. I don't think setting the shell makes a difference anymore (and I don't think it affects linux users at all... from memory, it was to get macOS to use the right version of git or something).

:h system() has a bit of info. I'm going to try some stuff out and push a branch you can try.

Thanks for your patience with this!

sodapopcan avatar Jun 22 '19 20:06 sodapopcan

I can confirm that the same error somehow persists on my mac partition (running macOS Mojave, with the latest versions of everything installed through brew)

AndrewCSQ avatar Jun 24 '19 02:06 AndrewCSQ

That is so strange. I've been having a very hard time reproducing it. All I can come close to is calling some version of shellescape and then I get a sort of similar error. I had to stop hacking on it the other day but hopefully get back to it in the next few days. Thanks for the update!

sodapopcan avatar Jun 24 '19 21:06 sodapopcan

I have the same issue witn nvim, and I also get ['1'] as output to that command.

mredaelli avatar Nov 06 '19 12:11 mredaelli

I also had the merge in progress problem. In my case it was because I had the project inside a path with a folder with a space in its name. There were no problems after I moved it to another path without folders with spaces.

jmolero avatar Jan 15 '20 11:01 jmolero

Same problem on latest Arch box on Vagrant (https://app.vagrantup.com/archlinux/boxes/archlinux)

jericdeleon avatar Apr 04 '20 15:04 jericdeleon

I've had the Not a git repository issue, but seems unlikely it's the same cause. For me, it seems this commit broke something. Specifically, this line:

autocmd VimEnter * if empty(expand('<amatch>'))|call FugitiveDetect(getcwd())|endif

If I add that to my .vimrc, :Twiggy seem to work just fine again.

j-sv avatar Apr 06 '20 13:04 j-sv

+1 to this issue. Have the same problem.

If I open a file within the repo, and then call :Twiggy, no problem. But with an empty buffer, this problem persists.

faisal-shah avatar Apr 16 '21 00:04 faisal-shah

Has there ever been a solution for this one. I'm hit by this now too.

languitar avatar Oct 01 '21 13:10 languitar

Hiya! I absolutely love this plugin, but am also getting this issue since yesterday. Welp! :(

Is there any way to debug this maybe? Using Neovim 0.5.1 on Arch btw.

thomas-ah avatar Oct 29 '21 08:10 thomas-ah

Hey all,

Apologies for the inattention here.

Does this happen even when you edit a file that is tracked by git? I can reproduce if I open vim in a repo and no file loaded in the current buffer.

I'll take some time today and/or tomorrow to see if I can fix it. Twiggy was my first ever vim-plugin and is full of tech-debt and very odd decisions, so some serious refactoring is in order.

sodapopcan avatar Oct 30 '21 14:10 sodapopcan

I have the same issue. Open nvim, open Twiggy, same message.

Then I open fugitive :Git once, and close it. Then Twiggy opens properly without complaining.

cd-a avatar Feb 16 '22 14:02 cd-a

Same as @dahmc here. I'm on Fedora using gvim.

frenkel avatar Feb 20 '22 12:02 frenkel

The workaround that @j-sv did seems to work in feel cases when starts inside a git project. But if I open a file of this project the error persists. Same for @dahmc advice.

https://user-images.githubusercontent.com/61889013/162455041-0b5cc598-36f2-4164-9c39-88f83b7ab370.mp4

Any solution?

sinetodev avatar Apr 08 '22 14:04 sinetodev

Lazy config for lazies to make Twiggy work at the start:

{
"tpope/vim-fugitive",
event = "VeryLazy",
  config = function()
    vim.cmd("call FugitiveDetect(getcwd())")
  end
},

Seems like this needs to be run after each cd (or session load), so hook appropriately.

devenv avatar Jul 20 '23 19:07 devenv

Lazy config for lazies to make Twiggy work at the start:

{
"tpope/vim-fugitive",
event = "VeryLazy",
  config = function()
    vim.cmd("call FugitiveDetect(getcwd())")
  end
},

Seems like this needs to be run after each cd (or session load), so hook appropriately.

I had the same error on nvim 0.9, macOS 13, Twiggy gave me the "not a git repo" error until after I had used a fugitive command within the session.

Adding this into my lazy config allows me to use Twiggy before having to do that just fine.

Edit: Actually, that's not the case - I'm back to nvim since october, but still get this error even with the hackfix above...

kristoferfannar avatar Oct 28 '23 18:10 kristoferfannar