jisaacks / GitGutter

A Sublime Text 2/3 plugin to see git diff in gutter
MIT License
3.88k stars 225 forks source link

All files marked as additions #279

Closed reintroducing closed 7 years ago

reintroducing commented 8 years ago

Hello, I'm having an issue where I've got two folders in my sidebar that contain different projects. Both are in the same repo and both have no modifications. One folder works as expected while the other continues to show every single file I open with plusses down the side denoting the file is new. I have no clue what the difference may be but I'm at a loss. Any ideas?

reintroducing commented 8 years ago

disregard, I just deleted the repo and re-pulled and everything works as expected now :)

reintroducing commented 8 years ago

I spoke too soon. When I edited a few files and then committed them, now they're all showing up as new again :\ I'm at a loss here, I'm not changing anything in my git config...

reintroducing commented 8 years ago

any ideas? would really love to get this working as i find this plugin invaluable on my work machine.

frangeris commented 8 years ago

Same here :/

Nickoladze commented 7 years ago

Ran into this issue today where my files suddenly showed every line with a green + while I had no outgoing changes at all. Deleting and re-cloning the repo fixed the issue for now.

The problem happened for both GitGutter and GitGutter-Edge installed via Package Control in ST3.

reintroducing commented 7 years ago

@Nickoladze Just tried doing that and it did not work for me :\

reintroducing commented 7 years ago

Well, I just removed ST3, upgraded to macOS Sierra and reinstalled and then reinstalled GitGutter and all seems well now. Going to close this I guess.

reintroducing commented 7 years ago

Welp, I'm back with the same issue now. Sigh.

@Nickoladze Where did you clone the repo into on your file system?

@frangeris Did @Nickoladze fix work for you as well? I see you thumbs upped it.

reintroducing commented 7 years ago

Disregard my question about where you cloned it, I just saw the Readme and did the same. Still not working for me (I probably did that same thing up there when i said it wasnt working for me but forgot my train of thought).

deathaxe commented 7 years ago

The issue you describe can mainly have 3 reasons.

  1. git show returns empty output and therefore the file to compare against is empty, too.
  2. Writing git's output to the temp file fails.

questions

  1. Do you see any exceptions or error messages about git in SublimeText's console?
  2. Do you compare against HEAD or a certain commit?
  3. The issue can't be solved by restarting Sublime Text?

things to check

Can you check the following steps, please:

  1. Do you find files biginning with git_gutter_... in your temporary directory?
  2. If so, please close all instances of SublimeText
  3. Delete any remaining temp file
  4. Open one file from your repo in Sublime Text
  5. Check if 2 git_gutter_... files are created (assuming one view with one file is open)
  6. Is one of the files empty?

how it works

What GitGutter does is, calling git show to copy the file from your repo to a temporary file. The content of the view is written to a temporary file as well, but this seems to work well - as you see the +. Both files are passed to git diff to find out the modifications.

deathaxe commented 7 years ago

In V1.4.0 all untracked or ignored files are marked with + if "show_markers_on_untracked_file": false If you turn on this setting, you'll see gray x or * for those files. A patch is in queue with pull request #338.

reintroducing commented 7 years ago

@deathaxe There are no errors in my console when loading up ST3. Here is the output:

startup, version: 3126 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/przybylski/Library/Application Support/Sublime Text 3/Packages
state path: /Users/przybylski/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/przybylski/Library/Application Support/Sublime Text 3/Installed Packages
ignored_packages: ["Markdown", "SublimeLinter-contrib-stylelint", "Vintage"]
pre session restore time: 0.246277
using gpu buffer for window
first paint time: 0.334737
startup time: 0.336027
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.comment
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.50-backrefs
reloading plugin 0_package_control_loader.50-markupsafe
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.50-pyyaml
reloading plugin 0_package_control_loader.51-python-jinja2
reloading plugin 0_package_control_loader.55-mdpopups
reloading plugin AutoFileName.autofilename
reloading plugin AutoFileName.getimageinfo
reloading plugin BracketHighlighter.bh_core
reloading plugin BracketHighlighter.bh_logging
reloading plugin BracketHighlighter.bh_plugin
reloading plugin BracketHighlighter.bh_popup
reloading plugin BracketHighlighter.bh_regions
reloading plugin BracketHighlighter.bh_remove
reloading plugin BracketHighlighter.bh_rules
reloading plugin BracketHighlighter.bh_search
reloading plugin BracketHighlighter.bh_swapping
reloading plugin BracketHighlighter.bh_wrapping
reloading plugin BracketHighlighter.support
reloading plugin Color Highlighter.ColorHighlighter
reloading plugin Color Highlighter.colors
reloading plugin DocBlockr.jsdocs
reloading plugin EditorConfig.EditorConfig
reloading plugin Git.git_commands
reloading plugin GitCommitMsg.GitCommitMsg
reloading plugin GitGutter.git_gutter
reloading plugin GitGutter.git_gutter_compare
reloading plugin GitGutter.git_gutter_events
reloading plugin GitGutter.git_gutter_handler
reloading plugin GitGutter.git_gutter_jump_to_changes
reloading plugin GitGutter.git_gutter_popup
reloading plugin GitGutter.git_gutter_settings
reloading plugin GitGutter.git_gutter_show_diff
reloading plugin GitGutter.git_helper
reloading plugin GitGutter.promise
reloading plugin Markdown Preview.helper
reloading plugin Markdown Preview.markdown_settings
reloading plugin Markdown Preview.markdown_wrapper
reloading plugin Markdown Preview.MarkdownPreview
reloading plugin MarkdownTOC.MarkdownTOC
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin SassBeautify.SassBeautify
reloading plugin SideBarEnhancements.SideBar
reloading plugin SideBarEnhancements.SideBarAPI
reloading plugin SideBarEnhancements.SideBarDefaultDisable
reloading plugin SideBarEnhancements.Stats
reloading plugin TabsExtra.support
reloading plugin TabsExtra.tab_menu
reloading plugin TabsExtra.tab_sort_helper
reloading plugin TabsExtra.tabs_extra
reloading plugin WordHighlight.word_highlight
reloading plugin Anaconda.anaconda
reloading plugin Anaconda.setup
reloading plugin Anaconda.version
reloading plugin Babel.Babel
reloading plugin HTML-CSS-JS Prettify.HTMLPrettify
reloading plugin Pretty YAML.PrettyYaml
reloading plugin SublimeCodeIntel.ordereddict
reloading plugin SublimeCodeIntel.SublimeCodeIntel
reloading plugin SublimeLinter.commands
reloading plugin SublimeLinter.sublimelinter
reloading plugin SublimeLinter-contrib-eslint.linter
SublimeLinter: eslint linter loaded 
reloading plugin Terminal.Terminal
plugins loaded
SublimeLinter: debug mode: on 
SublimeLinter: temp directory: /var/folders/n2/kj1b46ys2qgc13zr8yrgf5kw0000gn/T/SublimeLinter3-przybylski 
SublimeLinter: user shell: /bin/zsh 
SublimeLinter: computed PATH using /bin/zsh:
/Users/przybylski/.nvm/versions/node/v4.4.5/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

SublimeLinter: eslint: App.jsx ['/Users/przybylski/retrofit/dev/code/front-end/node_modules/.bin/eslint', '--format', 'compact', '--stdin', '--stdin-filename', '@'] 
Package Control: Skipping automatic upgrade, last run at 2016-12-11 16:24:37, next run at 2016-12-11 17:24:37 or after
reloading settings Packages/User/GitGutter.sublime-settings

I always compare against HEAD (i actually don't even know how to compare against another branch using GitGutter, it was always set to whatever is default). I've tried restarting sublime, re-installing GitGutter, uninstalling sublime and resetting it all back up, etc. Nothing seems to work, I always see the green pluses in the gutter.

I also don't have any files that belong with git_gutter on my whole file system (searched in Spotlight, nothing came up). Is there any specific commands you want me to run in specific steps that I may be missing?

deathaxe commented 7 years ago

Can you check, if the issue still exists in GitGutter-Edge? We patched some things related with untracked files handling and possible issues with invoking git command. Maybe they already fix your issue. If not I may provide a package with some debugging messages to find the reason.

reintroducing commented 7 years ago

yep, still happening in edge. i'd be more than happy to get a custom build to try out if you can just provide me with direction on exactly what you want me to do.

jisaacks commented 7 years ago

FYI: When you check git gutter edge just make sure that you have updated to the latest commit.

reintroducing commented 7 years ago

@jisaacks Is that any different than pulling down whats in Package Control?

jisaacks commented 7 years ago

@reintroducing if you are pulling via git you just need to make sure you pull the latest commits. If you are using Package Control, it will automatically update to the latest commit but I don't remember at what intervals, but you should be able to see what commit it is at you run "package control > list packages" and manually update if it is not already at the latest commit.

reintroducing commented 7 years ago

@jisaacks i did indeed install through PC.

deathaxe commented 7 years ago

I added some debugging messages to the current GitGutter-Edge commit and created a branch on my repo https://github.com/deathaxe/gitgutter/tree/debug so you can see what you download.

This is NOT meant for everyday use, just to find the reason for your issue.

The output in Sublime Text's console should look like this except you will get unix like pathes :-)

GitGutter: update_git_file(16) git show: ['C:\\Program Files\\Git\\mingw64\\bin\\git.exe', '--git-dir=C:\\Apps\\Sublime\\Data\\Packages\\GitGutter\\.git', '--work-tree=C:\\Apps\\Sublime\\Data\\Packages\\GitGutter', 'show', 'HEAD:git_gutter_handler.py']
GitGutter: git returns 0
GitGutter: update_git_file(16) git show returned 16327 chars
GitGutter: update_git_file(16) write 16327 bytes to c:\users\deathaxe\appdata\local\temp\git_gutter_dedfpd
GitGutter: update_buf_file(16) view has 16327 chars
GitGutter: update_buf_file(16) write 16327 bytes to c:\users\deathaxe\appdata\local\temp\git_gutter_isx33h
GitGutter: git returns 0
GitGutter: git stderr:
warning: LF will be replaced by CRLF in c:\users\deathaxe\appdata\local\temp\git_gutter_dedfpd.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in c:\users\deathaxe\appdata\local\temp\git_gutter_isx33h.
The file will have its original line endings in your working directory.

In most cases I encountered issues with empty output of git show or other git commands failing were caused by calling git not from within the work-tree directory. I guess the --work-tree and --git-dir arguments we use to be handled buggy by git. Let's see, if its true.