sodapopcan / vim-twiggy

Git branch management for Vim
280 stars 15 forks source link

"Not a git repository" Error #30

Open AndrewCSQ opened 5 years ago

AndrewCSQ commented 5 years ago

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

System Information

Replication

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)

sodapopcan commented 5 years ago

Oh my! What version of git are you using?

AndrewCSQ commented 5 years ago

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

sodapopcan commented 5 years ago

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 commented 5 years ago

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.

AndrewCSQ commented 5 years ago

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]..28_Render[39]..28_no_commits[1]..28_git_cmd[6]..28_system: line 11: E484: Can't open file /tmp/vvDbu4G/0

I suspect they stem from the same issue.

sodapopcan commented 5 years ago

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.

AndrewCSQ commented 5 years ago

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.

sodapopcan commented 5 years ago

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!

AndrewCSQ commented 5 years ago

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)

sodapopcan commented 5 years ago

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!

mredaelli commented 4 years ago

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

jmolero commented 4 years ago

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.

jericdeleon commented 4 years ago

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

j-sv commented 4 years ago

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.

faisal-shah commented 3 years ago

+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.

languitar commented 2 years ago

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

thomas-ah commented 2 years ago

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.

sodapopcan commented 2 years ago

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.

cd-a commented 2 years ago

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.

frenkel commented 2 years ago

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

sinetodev commented 2 years ago

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?

devenv commented 1 year ago

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.

kristoferfannar commented 10 months ago

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...