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

binary files #189

Closed
krya opened this issue Sep 10, 2014 · 6 comments
Closed

binary files #189

krya opened this issue Sep 10, 2014 · 6 comments
Labels

Comments

@krya
Copy link

krya commented Sep 10, 2014

if you try to open a binary file gitgutter raises an exception

Traceback (most recent call last):
  File "./sublime_plugin.py", line 339, in run_
  File "./git_gutter.py", line 45, in run
  File "./view_collection.py", line 51, in diff
  File "./git_gutter_handler.py", line 156, in diff
LookupError: unknown encoding: Hexadecimal

sublime 2 on linux here.

@jisaacks
Copy link
Owner

That's weird. The encoding/decoding name for hexadecimal in python is just hex, so I wonder why the view is returning hexadecimal as it's encoding. If you tried to decode with the string "hex" instead it would work.

I wonder if this is something that was fixed in ST3.. will test when I get a chance.

@KevinLi
Copy link
Contributor

KevinLi commented Jan 26, 2015

ST3 still returns "Hexadecimal" when in a hexadecimal view.
I've just made a pull request that should fix this.

@rchl rchl added the bug label Nov 16, 2016
@rchl
Copy link
Collaborator

rchl commented Nov 16, 2016

@KevinLi Can't see your pull request :)

@KevinLi
Copy link
Contributor

KevinLi commented Nov 18, 2016

Me neither! I have no idea what's going on!
It's been nearly two years; does the bug still exist?

@rchl
Copy link
Collaborator

rchl commented Nov 18, 2016

I think it still exists looking at the code. There is no rewriting of encoding from 'Hexadecimal' to 'hex'.

@jisaacks
Copy link
Owner

jisaacks commented Nov 18, 2016

Me neither! I have no idea what's going on!

Probably, you deleted the fork from your own account, which the PR was based on. So the PR went away?

deathaxe added a commit that referenced this issue Dec 3, 2016
As SublimeText's hexadecimal encoded representation of a binary file wouldn't
be saved to disk in a form git diff could handle it and there is no reason to show
markers for those files, the whole git_gutter command is disabled if a view
returns 'Hexadecimal' encoding.

Views marked as scratch are most likely not intended to represent normal files
so handle them like widgets.
@deathaxe deathaxe closed this as completed Dec 3, 2016
deathaxe added a commit that referenced this issue Dec 3, 2016
As SublimeText's hexadecimal encoded representation of a binary file wouldn't
be saved to disk in a form git diff could handle it and there is no reason to show
markers for those files, the whole git_gutter command is disabled if a view
returns 'Hexadecimal' encoding.

Views marked as scratch are most likely not intended to represent normal files
so handle them like widgets.
rchl pushed a commit that referenced this issue Dec 4, 2016
…ions

All these need to be re-added as pull requests and have a proper review.

Revert "Add some common linting rules and fixed some smaller code formating issues."

This reverts commit 4e15274.

Revert "Fix Issue #189: Disable GitGutter for binary files and scratch views."

This reverts commit ec007a6.

Revert "Fix Issue #264 "Broken Menu File""

This reverts commit fdbbb63.

Revert "Add 'Compare against file commit' and enable filtering by commit id (Issue #281)"

This reverts commit c6c8e90.

Revert "Make the status message somewhat smarter."

This reverts commit e3642b3.

Revert "Reduce module dependencies between git_gutter.py and its submodules."

This reverts commit 0aa5d45.

Revert "Show the correct branch or tag name in the 'compare against' status message."

This reverts commit 967f807.

Revert "Decode git output directly after reading from standard output."

This reverts commit f6967dd.

Revert "Securing git execution."

This reverts commit 0fd472d.
deathaxe added a commit that referenced this issue Dec 19, 2016
There are several situations running GitGutter might be useless or disturbing,
so it should keep disabled.

1. BINARY FILES

As SublimeText's hexadecimal encoded representation of a binary file wouldn't
be saved to disk in a form git diff could handle it and there is no reason to
show markers for those files, the whole git_gutter command is disabled if a
view returns 'Hexadecimal' encoding.

2. SCRATCH / READONLY / WIDGET VIEWS

Views marked as scratch or readonly are most likely not intended to represent
normal files so handle them like widgets and disable GitGutter.

3. UNATTACHED VIEWS

SublimeLinter disables linting for views with no valid window() attached and
states it as possible way to detect widgets for sure in some builts of
SublimeText.

4. SublimeREPL

The sublimeREPL plugin sets a view setting repl to mark a view as output.
SublimeLinter uses this setting to disable itself, so GitGutter should do so,
too. Where to check the view?

The git_handler is now created for all GitGutterCommand objects to
be used in its is_enabled method. This doesn't hurt as temporary
files are created on demand by git_handler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants