GithubHelp home page GithubHelp logo

Comments (21)

airblade avatar airblade commented on August 24, 2024

I'm not entirely sure what's going wrong but I made some updates just now which might fix this. Please could you grab the latest version of the plugin and try again?

from vim-gitgutter.

ljani avatar ljani commented on August 24, 2024

Tested with 21a27e0 and it's still there. I noticed that during the first save the "Error detected" is not shown, only the tempfile line. The second time the "Error detected" also appears.

from vim-gitgutter.

ljani avatar ljani commented on August 24, 2024

Also tested on a second computer with Windows 8 64-bit and the exact same problem happens there.

EDIT: checked the source, seems to be a call to git. I guess git doesn't play along with UNC paths very nicely. Maybe do a check if the file is located in an UNC path and disable the plugin if so?

from vim-gitgutter.

airblade avatar airblade commented on August 24, 2024

I'm grasping at straws but it seems like the problem is caused by Vim being unable to open a temp file while executing a shell command. The shelltemp documentation (:h shelltemp) explains a little. I presume that :echo &shelltemp gives you 0?

Maybe this is a filesystem permissions problem, i.e. whatever user Vim executes shell commands as doesn't have permission to write to the temp file location. Can you write a file from Vim to C:\Users\ljani\AppData\Local\Temp\?

from vim-gitgutter.

ljani avatar ljani commented on August 24, 2024

:echo &shelltemp gives me 1 and I can write to my temp folder without problems.

EDIT: sorry, wrong button (closed the issue accidentally).. A little tired here. :)
EDIT2: easiest to reproduce this is to create a file on your desktop and then open it from \\localhost\c$\Users\ljani\Desktop\. This path throws the error, but C:\Users\ljani\Desktop\ works just fine.

from vim-gitgutter.

airblade avatar airblade commented on August 24, 2024

Can you successfully run git commands from your shell using your UNC path?

from vim-gitgutter.

ljani avatar ljani commented on August 24, 2024
C:\Users\ljani>git --git-dir "\\localhost\c$\users\ljani\mygitrepo\.git" status
# On branch 3.0

C:\Users\ljani>git --git-dir "//localhost/c$/users/ljani/mygitrepo/.git" status
# On branch 3.0

So, yes. But I can't do cd \\localhost\ because of CMD does not support UNC paths as current directories.. On Windows 8 box CMD mounted the UNC path as a network drive IIRC.

from vim-gitgutter.

airblade avatar airblade commented on August 24, 2024

Does cd //localhost/ work?

Also, do either of these work?

git --git-dir "\\localhost\c$\users\ljani\mygitrepo\.git" status > /dev/null 2>&1
git --git-dir "\\localhost\c$\users\ljani\mygitrepo\.git" status > /dev/null 2>^&1

from vim-gitgutter.

ljani avatar ljani commented on August 24, 2024
C:\>cd //localhost/
The system cannot find the path specified.

C:\>cd //localhost/c$/
The system cannot find the path specified.

On Windows it's NUL, but I don't know what kind of abstractions/processing Vim makes since ~ (home) works in Vim, but not in cmd

C:\Users\ljani>git --git-dir "\\localhost\c$\users\ljani\mygitrepo\.git" status > /dev/null 2>&1
The system cannot find the path specified.

C:\Users\ljani>git --git-dir "\\localhost\c$\users\ljani\mygitrepo\.git" status > /dev/null 2>^&1
The system cannot find the path specified.

C:\Users\ljani>git --git-dir "\\localhost\c$\users\ljani\mygitrepo\.git" status > NUL 2>^&1

C:\Users\ljani>git --git-dir "\\localhost\c$\users\ljani\mygitrepo\.git" status > NUL 2>&1

from vim-gitgutter.

airblade avatar airblade commented on August 24, 2024

This sounds like it could be related to #44.

from vim-gitgutter.

drobati avatar drobati commented on August 24, 2024

I also have experienced this. I don't know what steps it takes to reproduce but it doesn't even need to save to a UNC address.

In my case I simply saved to "C:\Program Files (x86)\Vim_vimrc" and then saw the same error as described above.

The only difference is "19_is_active..19_is_in_a_get_repo:" the nineteens instead of sixties.

from vim-gitgutter.

airblade avatar airblade commented on August 24, 2024

Closing because this is a duplicate of #84 (which is now fixed).

from vim-gitgutter.

ljani avatar ljani commented on August 24, 2024

Well, it seems it's not a duplicate, because this is still fully reproducible at c896c9c. I noticed a difference tho..

With \\someothermachine\sharedfolder\test.txt the error is still the same:

Error detected while processing function GitGutter..<SNR>64_is_active..<SNR>64_is_in_a_git_repo:
line    2:
E484: Can't open file C:\Users\ljani\AppData\Local\Temp\VIo9934.tmp

But if I try the \\localhost\c$\test.txt trick, I get following error. I'm not sure if the errors are related to this plugin, but I just noticed them. Anyway, the new error:

"\\localhost\c$\test.txt" 9L, 875C
Error detected while processing BufEnter Auto commands for "*":
E344: Can't find directory "\\localhost\c$" in cdpath
E472: Command failed
Error detected while processing function GitGutter..<SNR>64_is_active..<SNR>64_is_in_a_git_repo:
line    2:
E484: Can't open file C:\Users\ljani\AppData\Local\Temp\VIoA516.tmp

EDIT: there are no other caches, but .vimviews (if any), right?

Current versions:

vim-gitgutter at c896c9c7f6da
git version 1.8.3.msysgit.0
vim 7.4, patches 1-3

from vim-gitgutter.

airblade avatar airblade commented on August 24, 2024

@ljani That's a pity! The plugin doesn't use any caches.

@wywong – any ideas?

from vim-gitgutter.

wywong avatar wywong commented on August 24, 2024

@ljani
@airblade

I tried using pushd instead of cd.
wywong@6955f6d

It seems to still work properly on linux and doesn't break anything new on windows.
The error messages are gone but it still doesn't work for UNC paths.

In particular, is_tracked_by_git() is always returning a shell error.

Line of interest
I think the problem here is the file name.
problem
The file name is passed as a UNC path which aren't supported by cmd.
cmd

I don't think this is something I can easily fix.

If you really need UNC path support I think powershell supports it.
I am not sure how to make vim use powershell instead of cmd.exe though.

I would recommend just making a symbolic link.
e.g. mklink /D local \localhost\C$

from vim-gitgutter.

airblade avatar airblade commented on August 24, 2024

@wywong Thanks! That's very helpful.

@ljani Would making a symbolic link take care of this for you?

from vim-gitgutter.

ljani avatar ljani commented on August 24, 2024

@wywong Thanks for the comprehensive info!
@airblade Well, I'm not even editing files tracked by git when on UNC path. The problem arises even if the file is not tracked by git and that's what I'm trying to get rid of without disabling vim-gitgutter entirely :) So, a preferable solution in my opinion would be detect an UNC path and disable vim-gitgutter for files on those paths, if it's not too much work. Also, it's not too hard to hit enter to skip the error, but it tends to be a little annoying tho, as I edit somewhat large amounts of text on network drives..

from vim-gitgutter.

wywong avatar wywong commented on August 24, 2024

@ljani
Did you try the minor tweak? (pushd instead of cd)
wywong@6955f6d
It should fix the error messages at very least.
If not, could you please post what the remaining errors are?

from vim-gitgutter.

ljani avatar ljani commented on August 24, 2024

@wywong:
Ah, sorry, I didn't yet, I was in a bit hurry, should've mentioned.

Anyway, switched to your branch, cleaned .vimviews and the error seems to be gone! Yay, thanks!

...But I noticed an another issue. If the path contains an ä, the same error is there. It might be related to either, vim-gitgutter or my encodings. I'm not quite sure how to continue investigating this.

The error again (with ä):

Messages maintainer: Bram Moolenaar <[email protected]>
"\\othermachine\share\Käyttäjä\test.txt" 8L, 35C
Error detected while processing function GitGutter..<SNR>64_is_active..<SNR>64_is_in_a_git_repo:
line    2:
E484: Can't open file C:\Users\ljani\AppData\Local\Temp\VIo842E.tmp
"test.txt" 8L, 35C written
Error detected while processing function GitGutter..<SNR>64_is_active..<SNR>64_is_in_a_git_repo:
line    2:
E484: Can't open file C:\Users\ljani\AppData\Local\Temp\VIo8C59.tmp

And the encodings:

set termencoding=cp850
set encoding=utf-8
setglobal fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,utf-16le,cp1252,iso-8859-15

The shell is the standard (Win 7), which uses cp850 afaik:

shell=C:\Windows\system32\cmd.exe

@airblade Should we split the issues, ie. close this and open a new one, or continue solving the ä issue here too? To confirm, this version is working for me: wywong@6955f6d. If you feel closing this one, feel free to to so when wywong@6955f6d is merged back in.

from vim-gitgutter.

wywong avatar wywong commented on August 24, 2024

@ljani
I noticed a similar problem with Chinese characters while working on issue #84.

Oddly enough the ä character doesn't seem to output any error messages.
I am currently using cp936.
no error messages
The gutter still doesn't work but there don't seem to be any error messages.

I think this is an issue with cmd.exe not the plugin.
fugitive
The above happened when I called :Git add % with the fugitive plugin.
Seems non ascii characters don't work well with cmd.exe

Do you have access to a windows 8 machine?
This didn't seem to be a problem with windows 8 when my friend tested it.

from vim-gitgutter.

airblade avatar airblade commented on August 24, 2024

I've just merged (6955f6d) @wywong's patch to use pushd instead of cd, which I think closes this issue.

Please feel free to open a new one for the non-ascii problem.

from vim-gitgutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.