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

use it on Windows 10 #39

Closed
kdurant opened this issue Nov 6, 2015 · 18 comments
Closed

use it on Windows 10 #39

kdurant opened this issue Nov 6, 2015 · 18 comments

Comments

@kdurant
Copy link

kdurant commented Nov 6, 2015

Default config for vimagit and use Magit command

Error detected while processing function magit#show_magit:
line   26:
E94: No matching buffer for magit-playground
"magit-playground" [Not edited] --No lines in buffer--
@jreybert
Copy link
Owner

jreybert commented Nov 6, 2015

Hi kdurant,

I don't have any easy access to a windows machine. Maybe you are the first windows user, I can't tell :)

I did a blind shot with 1067130 . Test branch next and tell me if it fixes anything for you.

Anyway, I can't say that vimagit is supported on windows. Travis doesn't offer Windows machine for regression test. If I break something, I won't know until someone opens an issue.

I hope it'll fix magit on windows.

Thanks

@jreybert jreybert added the bug label Nov 6, 2015
@kdurant
Copy link
Author

kdurant commented Nov 9, 2015

As same as the last

@jreybert
Copy link
Owner

jreybert commented Nov 9, 2015

Is it the exact same error message?

@jreybert
Copy link
Owner

Hi there,

I will need more feedback to try to fix vimagit for windows 10. Could you please try the next branch, and give the exact error message please?

@dfishburn
Copy link

When I try this on Windows 8.1, using Vim 7.4.1-930.
:Magit

magit can not find any git repository
make sure that current opened file or vim current directory points to a git repository
search paths:
C:\mypath\web\app
C:\mypathweb\app
Error detected while processing function magit#show_magit:
line   26:
E605: Exception not caught: magit_not_in_git_repo

Using the VimScript debugger (:h breakadd), I was able to see the following:

function magit#show_magit
line 6: endif
>
function magit#show_magit
line 8: let git_dir=''
>
function magit#show_magit
line 9: let try_paths = [ cur_file_path, getcwd() ]
>echo cur_file_path
C:\mypath\web\app\pm
>echo cur_file_path getcwd()
C:\mypath\web\app\pm C:\mypath\web\app\pm

>n
function magit#show_magit
line 10: for path in try_paths
>n
function magit#show_magit
line 11: let git_dir=magit#git#is_work_tree(path)
>s
function magit#show_magit[11]..magit#git#is_work_tree
line 1: let dir = getcwd()
>n
function magit#show_magit[11]..magit#git#is_work_tree
line 2: try
>
function magit#show_magit[11]..magit#git#is_work_tree
line 3: call magit#utils#lcd(a:path)
>echo a:path
C:\mypath\web\app\pm
>n
function magit#show_magit[11]..magit#git#is_work_tree
line 4: let top_dir=magit#utils#strip( system(s:git_cmd . " rev-parse --show-toplevel")) . "/"
>n
function magit#show_magit[11]..magit#git#is_work_tree
line 6: if ( v:shell_error != 0 )
>echo top_dir
'GIT_CONFIG' is not recognized as an internal or external command,
operable program or batch file./
>echo s:git_cmd
GIT_CONFIG=/dev/null GIT_CONFIG_NOSYSTEM=1 XDG_CONFIG_HOME=/ git

Just looking at the command line executed:
GIT_CONFIG=/dev/null GIT_CONFIG_NOSYSTEM=1 XDG_CONFIG_HOME=/ git

No way that will work on Windows. The command must be an executable.
"git.exe" or something, it cannot be preceded by stuff like this:
GIT_CONFIG=/dev/null

Based on what I am seeing, you are trying to find the top_dir using:
system(s:git_cmd . " rev-parse --show-toplevel")

This works just fine, with a normal git command, for example:
system("git rev-parse --show-toplevel")
C:/mypath

So I have added this to my vimrc, which allows me to specify a full path including double quotes just in case there are spaces in my path.
let g:magit_git_cmd='"C:\Program Files\Git\cmd\git.EXE"'

Then modified this file, right at the top:
vimagit-1.5.1\autoload\magit\git.vim

Changed to this:

if exists('g:magit_git_cmd')
    let s:git_cmd=g:magit_git_cmd
else
    let s:git_cmd="GIT_CONFIG=/dev/null GIT_CONFIG_NOSYSTEM=1 XDG_CONFIG_HOME=/ git"
endif

Things appear to be working for me now.

@jreybert
Copy link
Owner

jreybert commented Dec 4, 2015

Thanks a lot @dfishburn !

I must take the time to install a windows virtual machine to perform tests. I hope I will include windows support in next release, but it should be fixed in next branch soon.

Anyway, I won't officially support windows before I setup a continuous inegration for windows, and I fear it will take a lot of time (mush more than fix the potential bugs :/ ). I will test www.appveyor.com as soon as I found some time.

@dfishburn
Copy link

I understand, about not officially supporting windows until you have a valid environment to test on.

If you do make some of the changes I have outlined, I am happy to test them.

So far with the changes I outlined above, your plugin has allowed me to perform my first ever git commits. So thank you very much. I tried Vim's fugitive plugin but I found Vimagit much more easy to use and understand.

Thank you for your hard work.

@tiagoboldt
Copy link

Hi,

I'm reproducing this in linux/osx using the FISH shell. I believe the problem is the same, FISH doesn't accept env vars being set that way before invoking a binary file. Can I provide any additional info to help debug it? Fish will definitely be an easier way to replicate this. Let me know if I should fork this into a new issue.

@jreybert
Copy link
Owner

There's definitly a problem around environment variables. I'll craft a patch soon around that, but I think it won't fix all on windows.

@dfishburn
Copy link

Just to be clear.

Any new release (like the 1.5.2) and anything you ask me to test, I can't since you haven't made this simple and totally backwards compatible fix (which I outlined above):

So I have added this to my vimrc, which allows me to specify a full path including double quotes just in case there are spaces in my path.

let g:magit_git_cmd='"C:\Program Files\Git\cmd\git.EXE"'

Then modified this file, right at the top:
vimagit-1.5.1\autoload\magit\git.vim

Changed to this:

if exists('g:magit_git_cmd')
    let s:git_cmd=g:magit_git_cmd
else
    let s:git_cmd="GIT_CONFIG=/dev/null GIT_CONFIG_NOSYSTEM=1 XDG_CONFIG_HOME=/ git"
endif

If you make that simple change, it will NOT affect any other users unless they define a g:magit_git_cmd.

If will allow all Windows users to use the plugin (as I have been for 2 months).

It will allow all FISH users to be able to override this environment variable problem (listed above).

Make the simple change and you will allow us to continue to work with you and test additional features.

If you also put it in "master" I can test that branch too.

David

@jreybert
Copy link
Owner

@dfishburn , add a global magit_git_cmd variable was what I meant in my previous comment.

For such simple changes, a pull request very is welcome! If so, the best way is to add this g:magit_git_cmd default definition on top of plugin/magit.vim, like other global (but overridable) variables.

Cheers

@dfishburn
Copy link

I haven't done stuff with Github, so don't really know how to send you a pull request.

This change is incredibly simple.
Just change that first line in autoload\magit\git.vim to the 5 lines I provided.

@jreybert
Copy link
Owner

This change is incredibly simple.

That's why I encourage you to make a pull request. Anyway, I'll do it.

@jreybert
Copy link
Owner

Hi everyone, could you post your environment (OS, shell name and version) to #75

I'll try to propose a default git command for each comment environment.

@jreybert
Copy link
Owner

please check branch next, and comment on #74

Thanks

@jreybert
Copy link
Owner

@kdurant could you please check issue #74, thanks.

@jreybert
Copy link
Owner

And to everyone, could you please please update this ticket if banch next is OK on windows?

@jreybert
Copy link
Owner

As no one seems to complain, I close this ticket. If someone still has an issue with Windows 10, feel free to reopen the ticket.

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

4 participants