timbrel / GitSavvy

Full git and GitHub integration with Sublime Text
MIT License
1.91k stars 137 forks source link

Inline diffs showing up empty on ST 3129 #634

Closed 0x4C4A closed 7 years ago

0x4C4A commented 7 years ago

Hello!

Just tried to inline diff and then the basic diff via gitSavvy on multiple projects - the inline diff showed an empty tab, while the basic diff worked.

Here's a log file of me doing the following actions

  1. Enabling the log on status screen
  2. Pressing L for inline diff, then closing that tab when it comes up empty
  3. Pressing E for basic diff on same file, then closing that tab
  4. Disabling log
stoivo commented 7 years ago

Can you you look in the console(View -> Show Console (on Mac))? I think it crashes somewhere, since there should me a git call like git diff --no-color -U0 to get the diff. This call is missing.

Also Platform git Version

0x4C4A commented 7 years ago

Seems like I tricked myself on this one - apparently I've installed the package while running sublime with sudo.

I ran it with the console open and it gave me this

Traceback (most recent call last):
  File "core.commands.inline_diff in /home/linards/.config/sublime-text-3/Installed Packages/GitSavvy.sublime-package", line 37, in <lambda>
  File "core.commands.inline_diff in /home/linards/.config/sublime-text-3/Installed Packages/GitSavvy.sublime-package", line 62, in run_async
  File "core.commands.inline_diff in /home/linards/.config/sublime-text-3/Installed Packages/GitSavvy.sublime-package", line 121, in augment_color_scheme
  File "common.theme_generator in /home/linards/.config/sublime-text-3/Installed Packages/GitSavvy.sublime-package", line 83, in apply_new_theme
  File "common.theme_generator in /home/linards/.config/sublime-text-3/Installed Packages/GitSavvy.sublime-package", line 73, in get_new_theme_path
PermissionError: [Errno 13] Permission denied: '/home/linards/.config/sublime-text-3/Packages/User/GitSavvy/GitSavvy.active-diff-view.js.hidden-tmTheme'

After that I investigated the folder and found a file named "GitSavvy.active-diff-view..hidden-tmTheme" so I tried copying it as the file it was complaining about, and additionally chmodding it - it suddenly started working. Confused, I removed the GitSavvy package and deleted the Packages/User/GitSavvy directory, and reinstalled the GitSavvy package. Now it worked. Only possible thing I could think of was running Sublime with sudo and then installing GitSavvy. Sure enough, installing GitSavvy, when Sublime's run with sudo made the same problem happen.

Maybe it'd be useful to add some sort of warning for users who're installing this package while Sublime is run with su? (Or is there no way to check?)

Platform: Linux Mint 18.1 x64 (4.4.0-53-generic) Git: 2.7.4

stoivo commented 7 years ago

Right, since it doesn't add complexity to the code I think we can add this warning.