How can I figure out why this isn't working? #20

Closed
ashmoran opened this Issue Dec 15, 2012 · 54 comments

Projects

None yet
@ashmoran

I've just installed this (and restarted Sublime – not usually necessary) but it doesn't display anything. I'm definitely in a Git repo, I'm working in my project folder for this: https://github.com/ashmoran/language_implementation_patterns

I don't know how to debug the problem, can anybody help?

@jisaacks
Owner

@ashmoran follow these steps

  • In sublime, type ctrl+` to open your console
  • Make a change to a file, look for an error in the console
  • If that did not generate an error; type this into your console view.run_command('git_gutter')

Once you get an error message, if you cannot decipher whats wrong, post it here.

@ashmoran

@jisaacks Thanks. Results:

  • No output on file change
  • No output on running view.run_command('git_gutter')
@jisaacks
Owner

Can you confirm that it is installed?
Are you trying this on a file that is currently being tracked by git, and you have made changes?

If yes for all, here are some possible troubleshooting steps you might use to diagnose the problem:

  • Open the GitGutter directory in your Packages directory
  • open the file git_gutter_handler.py
  • locate to the function __init__
  • print these lines after the variables are defined:
print self.git_temp_file.name
print self.buf_temp_file.name

Now when you run git gutter, in the same console you have been using, you should see the path to the 2 temp files it uses to process the diff.

If you see the files paths, opens them up and look at the contents, what do you see?

If you still don't see any output, try these steps:

  • In the GitGutter directory open git_gutter.py
  • locate the run function
  • make this the first line of the function print "Yes git gutter is runnung"
  • Run git gutter again and confirm it is actually running be seeing the above string as output.
@ashmoran

Well that was weird. I'd already checked it was installed. I copied the debugging lines you gave into the file, and this achieved nothing. Then when I went back to look at them, they'd disappeared. Then Package Control decided to update itself, at which point everything magically started working.

I have absolutely no idea what went wrong, or what fixed it, but it works now. Sorry for the noise! And thanks for your help!

@jisaacks
Owner

@ashmoran No problem, glad it is working for ya, I am going to close this issue now then.

@jisaacks jisaacks closed this Dec 15, 2012
@ashmoran

And… it just mysteriously stopped working again :-/

I'm going to disable this package for now. Hopefully(?!) someone else will have the same issue and be able to diagnose it better. I might come back and have another go later. Unfortunately there's only so much time I can justify trying to get a package to work, and this one isn't critical to me.

Thanks for your help so far.

@cmer
cmer commented Feb 7, 2013

Same for me, I had to install it twice. Now it works. Very odd.

@batamire

I had exactly the same problem.
Both git_temp_file and buf_temp_file had intended content.

I solved it by removing this from my global gitconfig:

[color]
ui = always

Weird?

@gstjohn
gstjohn commented Feb 19, 2013

Having a problem getting it to run as well:

Traceback (most recent call last):
File "./sublime_plugin.py", line 339, in run_
File "./git_gutter.py", line 42, in run
File "./view_collection.py", line 36, in diff
File "./git_gutter_handler.py", line 146, in diff
File "./git_gutter_handler.py", line 162, in run_command
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in init
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

@jisaacks
Owner

@garrettstj what OS are you using?

@jisaacks
Owner

Obviously people are still having an issue so I am reopening.

@jisaacks jisaacks reopened this Feb 20, 2013
@bspingarn

I too am getting that error. Running Mtn Lion and ST2 2.0.1 Build 2217.

    OSError: [Errno 2] No such file or directory
    Traceback (most recent call last):
      File "./sublime_plugin.py", line 339, in run_
      File "./git_gutter.py", line 42, in run
      File "./view_collection.py", line 36, in diff
      File "./git_gutter_handler.py", line 146, in diff
      File "./git_gutter_handler.py", line 162, in run_command
      File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
      File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
@jisaacks
Owner

I will look into this when I get a chance. In the mean time if you want to help trouble shoot this, something you can do is install via git and checkout older commits and see if you can pinpoint if/where this issue was introduced.

@aprescott

I was having the same problem with no changes and no output, as if it isn't installed. Originally installed with Package Control. I tried cloning the repo and in doing so discovered a way to reproduce working and broken states with both the cloned repo and Package Control.

System is Mac OS X Lion 10.7.5. Assumes you have subl available as per the OS X documentation.

Broken:

  • Either install Git Gutter with Package Control or have the package installed already.
  • (It was broken at this point for me.)
  • Quit Sublime Text with open windows.
  • Start Sublime Text from the dock so that it reopens windows that were open last time it was running.
  • Change lines, nothing will happen.

Working:

  • Either install Git Gutter with Package Control or have the package installed already.
  • Close all Sublime Text windows and quit Sublime Text so the process is not running.
  • cd to the directory containing a git repo + the files you want to edit and run subl . to open the directory.
  • Change lines, gutter icons show up.

Broken:

  • Either install Git Gutter with Package Control or have the package installed already.
  • Close all windows and quit Sublime Text so the process is not running.
  • Open Sublime Text (through the dock) so it's an empty window.
  • Open a directory through Project > Recent projects. (For me, my project file has certain directories ignored like .sass-cache.)
  • Change lines, nothing will show up.

Working:

  • Same as the previous steps, but use subl (not subl .) instead of the dock before going to Project > Recent projects.
  • Works.

Working (somewhat redundant, but hey):

  • Close all windows and quit Sublime Text so the process is not running.
  • Open Sublime Text (with the dock) so it's an empty window.
  • Open a directory through Project > Recent projects. (.sass-cache not showing, because it's ignored int the project.)
  • Change lines, nothing will show, broken as above.
  • Quit Sublime Text without closing windows.
  • cd to the directory and run subl, which will reopen Sublime Text with the previous project windows open (.sass-cache not showing, so it's still a project not just a directory).
  • Change lines, gutter icons show up.

So it seems there is something to do with using subl? I'd guess the dock icon goes through a different execution path. Same for Spotlight.

(Trying to use the dock icon + File > Open... for the first working steps above leads to it being broken. Using subl + File > Open... or File > Open recent... works fine.)

Just for extra points, opening /Applications/Sublime Text 2.app/Contents/MacOS in Finder and starting it with Sublime Text 2 from there seems to also work.

So I guess if you want it working, quit the process and run it with subl or use /Applications/Sublime Text 2.app/Contents/MacOS.

@jisaacks
Owner

@aprescott I was noticing this last night. Very strange. Thanks for pointing it out.

@jisaacks
Owner

@aprescott I pushed a change fbf65a8 that I think fixes the issue you reported (at least it did for me) can you pull/upgrade to the latest code and see if that fixes it for you.

@michaelprobst

Still not working for me:

Traceback (most recent call last):
File "./sublime_plugin.py", line 339, in run_
File "./git_gutter.py", line 32, in run
File "./view_collection.py", line 36, in diff
File "./git_gutter_handler.py", line 146, in diff
File "./git_gutter_handler.py", line 162, in run_command
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in init
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
OSError: [Errno 2] No such file or directory

@aprescott

@aprescott I pushed a change fbf65a8 that I think fixes the issue you reported (at least it did for me) can you pull/upgrade to the latest code and see if that fixes it for you.

Seems to still be broken with the same behaviour.

@cherring
cherring commented Mar 4, 2013

I have also been having trouble with GitGutter. I have checked it out via git and the last working revision for me is bb00c22

@gstjohn
gstjohn commented Mar 6, 2013

Great debugging @aprescott. I am experiencing all of the same as you. Latest Package Control upgrade doesn't fix the issue. Latest master commit doesn't fix it. Running OSX 10.8.2 with ST2 Dev Channel Build 2220.

@DavidLGoldberg
Contributor

@jisaacks I'm not sure if this related slightly different symptoms of the same issue?

I had a scare thinking we introduced a performance bug with the introduction of the jump code. It turns out the same happens on the prior commit as well (didn't go too far back)

Can reproduce on windows 7, 2 year old laptop:

  1. Close sublime.
  2. Open sublime to defaulted text file under git control
  3. *Slow performance on view's typing. Delayed response similar to VPN lag. Was able to type a whole sentence without seeing the text.
  4. ctrl+shift+p -> package disable -> GitGutter
  5. *Perfect performance
  6. ctrl+shift+p -> package enable -> GitGutter
  7. *Perfect performance <----------------------------- This is the weird part.

I was able to reproduce this on several commit shas. Is this a known sublime issue, or very specific to your plugin? Perhaps you can cheat and fire a disable -> enable on load ;-)

I'd be willing to bet there's one fix for both of these issues.

@jisaacks
Owner

@DavidLGoldberg did you try disabling GitGutter before step 1 and see if there is no longer a performance issue when you close and reopen?

I followed your steps but I am unable to reproduce on my 2011 Macbook.

@DavidLGoldberg
Contributor

@jisaacks I've narrowed the issue down to about a line of code. It should only happen on windows I believe. I confirmed here at work as well. It relates to the NamedTemporaryFile call. The following article has some useful info:
http://bugs.python.org/issue14243

I can try to work on a fix either tonight or tomorrow night. If you have any ideas but don't feel like fixing it, feel free to send them my way too.

For now turning off live_mode makes everything work fine.

@JLMorales

I am getting:
Error trying to parse settings: No data in
C:\Users{username}\AppData\Roaming\Sublime Text 2\Packages\User\GitGutter.sublime-settings:1:1
This opens in a dialog box before loading ST2, and it prevents it from loading entirely. The process is stuck thouch, but no gui is loaded. So I have to CTRL+SHIFT+ESC to end process and try again. To solve it, I had to delete the entire GitGutter folder from the user data folder as shown above. The settings file is there and it is filled with settings, but I am unsure what triggers this error.

Before this error, I was getting no file or directory error, and before that, I was getting a Windows(5) error in ST2 console, saying something about access denied.

I am uninstalling it and installing it again. I want to see if I can make it work, but it seems like a long-shot.

Running windows7 here...

@DavidLGoldberg
Contributor

@JLMorales did you try to turning off live_mode in the settings? I actually prefer the plugin with it off anyway. Definitely not worth abandoning the plugin because of live mode.

@JLMorales

I did try it. It still gave errors.

Sent via the Samsung Galaxy S™II Skyrocket™ an AT&T 4G LTE smartphone."David L. Goldberg" notifications@github.com wrote:@JLMorales did you try to turning off live_mode in the settings? I actually prefer the plugin with it off anyway. Definitely not worth abandoning the plugin because of live mode.


Reply to this email directly or view it on GitHub.

@msiemens

For me the problem was, that when running the git diff command, git returned fatal: LF would be replaced by CRLF in, without any diff (I'm running a Windows computer). Running git config --global core.safecrlf warn solved this problem and now it works without problems.
Maybe it would make sense to check the return state of git diff and at least print a warning to the console, if it fails.

@JLMorales

I'll try that, but right now it is doing something new, totally strange and weird.

After closing the editor, and re-opening, it pops a warning saying:
Error trying to parse settings: No data in C:{path-to-Roaming}\Sublime Text 2\Packages\User\GitGutter.sublime-settings:1:1

The editor crashes - the process still runs in the machine, but the gui is gone. I have to manually navigate to the folder and delete the gitgutter folder... open the editor, remove the package via package control and re-install... same thing has kept happening... probably something is really messed in my configuration and I am unaware...

@jisaacks
Owner

@JLMorales did you upgrade GitGutter from an old version, or was it a new installation?

I think there is a bug when you upgrade GitGutter from a version before it had GitGutter.sublime-settings and it immediate starts trying to use GitGutter.sublime-settings after upgrading but is unable to until sublime restarts.

@JLMorales

No, I didn't have it before.

Thanks for following up with my messed up install... I am almost sure it has to be some sort of corrupted installation file somewhere. After removing the files from the Packages folder, and removing the package from package manager (so it removes it from its list), I close ST2, and reopen, then install gitgutter again.

Upon installing it, it shows me that dialog box again. At that point, it does not crash the editor, but closing and reopening gives me the behavior I explained in my previous post.

I am not sure... but if the folders for Packages under that Roaming user folder, are just a user copy, then I must go find the rest of the files elsewhere so I can delete gitgutter from everywhere and clean install again... since the error I cannot use package manager to properly remove it... so I will have to find a way around that...

@shmup
Contributor
shmup commented Mar 21, 2013

It still happens on OS X, just so you're aware. It was fine, but I suppose I must assume it broke during an "Upgrade/Overwrite All Packages"?

Traceback (most recent call last):
  File "./sublime_plugin.py", line 339, in run_
  File "./git_gutter.py", line 34, in run
  File "./view_collection.py", line 36, in diff
  File "./git_gutter_handler.py", line 147, in diff
  File "./git_gutter_handler.py", line 163, in run_command
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 623, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/subprocess.py", line 1141, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
@aprescott

I was having the same problem with no changes and no output, as if it isn't installed.

Just a note to say that my problem of needing to use subl . as per a previous description still exists as of version 2013.03.10.11.15.25.

@JLMorales

At the risk of sounding like a jerk, I switched to one of the projects that forked this one, and VCS Gutter worked outta the box for me. I would look into their codebase to check things out...

@jisaacks
Owner

@JLMorales a lot as bean added since that fork. Something new is probably conflicting with you. You could try checking out older commits and try to pinpoint which commit screws things up for you.

@JLMorales

I don't have time right now, but after this project I'm finishing right now, I'll give that a shot. Will post back with the commit that works for me. Thanks for following up with this. Kudos - this is quite handy.

@shmup
Contributor
shmup commented Mar 31, 2013

The fix for the issue currently is in git_gutter_handler.py, line 168:

I changed self.git_binary_path = 'git' to the actual path '/usr/local/git/bin/git'.

@jisaacks
Owner

@shmup you can set the git path without editing the source. You just need to specify it in the settings, see the read me

@shmup
Contributor
shmup commented Mar 31, 2013

@jisaacks I did have it specified in my settings, actually. I had to do that at a time for some reason, which also never really made sense to me, as git is in my PATH. It's in my settings just as I hard coded it in git_gut_handler.py, though.

@jisaacks
Owner
jisaacks commented Apr 1, 2013

@shmup hmm, why don't you try adding print self.settings.get('git_binary') and check the console to see what it says? It should be what you have specified in the settings.

@martin-brennan

I had this same issue on Windows; I had the git.exe path set in my PATH variable and GitGutter was giving me the same list of errors. It was solved for me by setting the git_binary_path manually in the User settings.

@shmup
Contributor
shmup commented Apr 1, 2013

@jisaacks, I finally tried really looking into it. Didn't take long, and the problem is just that I was adding the git_binary to my Preferences.sublime-settings, and it would probably be a good thing if the handler looked there too, right?

I think it should first check Preference settings, and then GitGutter settings. Preferences is the file that people are likely going to edit anyways.

I sent a pull request: #82

@AdamWagner

+1
I'm also having this issue. Using Mountain Lion.

@emil-nasso

+1 here too.
Running osx here too. Anyone found a solution?

Edit: I fixed it by setting an absolute path to the git binary in the git gutter preferences file.
Git was in my path.

@RwwL
RwwL commented Jun 10, 2013

I upgraded from Lion to Mountain Lion on Friday, and just noticed this issue this morning (the following Monday), though I can't say for sure that's what triggered it.

Like @emil-nasso above, it appears to be fixed for me after setting the setting the absolute path to the git binary in the git gutter preferences file. Git was in my path as well.

@aprescott

The bug I outlined above with the workaround of running subl from the command line seems to have resolved itself. Starting it from the Dock now has it functional.

@kalimaka

I have the same problem (on windows, cygwin + port 1.8.3 git) but manage to see that it was due to path interpretation of git's cygwin. For instance, the following command do nothing :
c:\cygwin\bin\git.exe diff c:/temp/tmpruq0pn c:/temp/tmpr0qpbn
but changing the path of the files to : c:\cygwin\bin\git.exe diff /cygdrive/c/temp/tmpruq0pn /cygdrive/c/temp/tmpr0qpbn return the expected result.

So, I've just replaced quickly (I may do something more convenient later, but it can help at present...) the lines in git_gutter_handler.py (l.138), to convert to cygwin path :

def diff(self):
    if self.on_disk() and self.git_path:
        self.update_git_file()
        self.update_buf_file()
        args = [
            self.git_binary_path, 'diff', '-U0', '--no-color',
            self.ignore_whitespace,
            self.patience_switch,
            #self.git_temp_file.name
            self.run_command(["c:\\cygwin\\bin\\cygpath.exe", "-u", self.git_temp_file.name]),
            #self.buf_temp_file.name
            self.run_command(["c:\\cygwin\\bin\\cygpath.exe", "-u", self.buf_temp_file.name])
        ]

Hope it helps

@AndreasHeiberg

@emil-nasso and @RwwL the problem was resolved after adding the absolut path to git in my git gutter preferences. Btw the path can be found by running "which git" in terminal.

@jisaacks
Owner

I think @AndreasHeiberg's comment is most likely what most people are experiencing and should resolve the issue. Is anyone still having trouble?

@smarigowda

I had the same issue. It is resolved after adding absolute path to git.

@tastycakeman

Editing the path as mentioned above fixed this problem for me as well.

@jisaacks
Owner
jisaacks commented Feb 3, 2014

OK been 3 months and it seems like that is the issue so I am closing this for now.

@jisaacks jisaacks closed this Feb 3, 2014
@arsen91
arsen91 commented Apr 4, 2014

Sorry for nooby question on the closed issue.. Where do I put the absolute path and what is the syntax?...
Thanks

@gtmsingh
gtmsingh commented Nov 6, 2014

I had the same problem and I fixed it by editing the settings of GitGutter.
I have added the git_binary pointing to the git.exe file in my computer in the user settings file of GitGutter

PS. for windows users, please use "\" instead of "" as the directory separator in the path pointing to the binary file

@DHedgecock

Just worked through this on Windows 7 using ST3. This worked for me:
Add this to Environment Path(assuming this is where you have Git installed):
C:\Program Files (x86)\Git\bin
Love this plugin by the way! --Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment