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

Invalid git URI when calling :PlugStatus or :PlugClean #12

Closed
Xifax opened this issue Mar 12, 2014 · 10 comments
Closed

Invalid git URI when calling :PlugStatus or :PlugClean #12

Xifax opened this issue Mar 12, 2014 · 10 comments

Comments

@Xifax
Copy link

Xifax commented Mar 12, 2014

When calling one of those commands, vim-plug confuses all plugins URIs with the URI of the current folder.

For example, running PlugStatus when in ~/.vim (which contains its own git repository) results in this:

Finished. 74 error(s).
x vim-cute-python:
     Invalid URI: https://github.com/Xifax/yavir.git
     Expected:    https://git:@github.com/ehamberg/vim-cute-python.git
     PlugClean required.
     ...

PlugInstall and PlugUpdate work perfectly well.

@junegunn
Copy link
Owner

Thanks for the report. Strangely, I can't seem to reproduce the problem. I even tried with your configuration, but it worked fine. So, you mean, those commands fail only when the current directory is a git repository?

" So this fails
:cd ~/.vim | PlugStatus

" But this works
:cd ~ | PlugStatus

Am I right?

@Xifax
Copy link
Author

Xifax commented Mar 12, 2014

As I understand, it takes URI from :!pwd, ignoring Vim's own :pwd. If there's no git repo (e.g., home dir), the following message will be displayed:
fatal: Not a git repository (or any of the parent directories): .git
As such, it will fail regardless of current directory.

It could possibly be side effect of another plugin or some peculiar system settings. I'll try to experiment some more and report back.

@junegunn
Copy link
Owner

Basically when running PlugStatus or PlugClean, vim-plug will "cd" into the plugin's directory and execute git command to determine the remote URI. You can try the following code and see if it correctly retrieves the URI.

execute 'cd '.values(g:plugs)[0].dir
let remote =
\ substitute(
\   split(
\     system('git rev-parse --abbrev-ref HEAD && git config remote.origin.url'),
\     "\n")[-1], 'git:@', '', '')
echom remote
cd -

@Xifax
Copy link
Author

Xifax commented Mar 12, 2014

It appears to get correct URI for plugin only if I use

execute '!cd '.values(g:plugs)[0].dir

Otherwise, it will try to call git command on system pwd.

@junegunn
Copy link
Owner

Hmm, that's interesting. Could you tell me more about your environment so I can further investigate on the issue? (OS, Vim version, shell)

@Xifax
Copy link
Author

Xifax commented Mar 12, 2014

ArchLinux, kernel 3.13.6-1
Fish shell, 2.1.0
Vim 7.4, patches 1-135
Git 1.9.0

@junegunn
Copy link
Owner

Okay thanks! I'll try to test it on a similar environment tomorrow.

@Xifax
Copy link
Author

Xifax commented Mar 12, 2014

Thanks a lot. I'll try some different environment too.

@junegunn
Copy link
Owner

Okay, I've set up an Arch Linux VM with a similar environment as yours.
One thing I noticed is that system() fails and I needed to set shell=/bin/sh in Vim.
(See: http://badsimplicity.com/vim-fish-e484-cant-open-file-tmpvrdnvqe0-error/)
But once it's done, both :PlugClean and :PlugStatus work fine.
And :pwd and :!pwd are not different.

:cd /tmp

" /tmp
:pwd

" /tmp
:!pwd

Have you tried set shell=/bin/sh ?

@Xifax
Copy link
Author

Xifax commented Mar 13, 2014

Yes, it works! I had my shell set to zsh, actually. Setting it to /bin/sh helped.
Thanks for your help.

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

No branches or pull requests

2 participants