atom/git-diff

Git shows every line has been altered.

jackjameshoward opened this issue · 6 comments

Prerequisites

Description

Whenever I clone a repo and make an edit to any file, git-diff shows that every line in the file has been delete and an equal number of lines has been replaced. If I git add/commit/push/pull/fetch/merge the result is always the same in atom; if I change anything in atom it decects every line has been altered.
image
Curiosly if I check what was commited via git, it will accurate show that only one line has changed.

Steps to Reproduce

  1. git clone a repo
  2. open Atom
  3. add Project Folder (Ctrl+Shift+A), add cloned repo folder.
  4. open any file from repo - for example index.html
  5. change anything one a single line in file and save file
  6. bottom right corner states +200, -200 lines (for example)
  7. git add and git commit
  8. git commit reads +1, -1 line chaged
  9. atom now reads up to date.
  10. repeat steps 5 to 10 and the outcome never changes

Expected behavior: Atom should read +1, -1 lines changed

Actual behavior: Atom shows all lines in file removed and an equal number replaced.

Reproduces how often: This occurs on a freash install of Atom and a newly cloned repo.

Versions

I have done a fresh install using the atom-x64-windows.zip package.
It was install on a USB drive on a pc with Windows 7. I have followed the flight manual for converting to portable mode e.g. move the .atom folder to the correct location.
There are no user installed packages.

atom --version

Atom : 1.14.4
Electron: 1.3.13
Chrome : 52.0.2743.82
Node : 6.5.0

apm --verison

apm 1.15.3
npm 3.10.5
node 4.4.5 x64

This is most likely because of your core.autocrlf settings in Git. Try setting it to false and see if that changes anything.

That seemed to do the trick. Thanks @50Wliu

Awesome, glad it worked!

@50Wliu
Heyyy, it's not a solution, it's a workaround!
I expect the plugin to show diff line just the same as git diff command does, why is it still not a thing?

Please reopen the issue.

Heyyy, it's not a solution, it's a workaround!
I expect the plugin to show diff just as git diff command does, why is it still not a thing?

@qwemaze It does work, and what you are referring to is not a workaround...

If you can reliably reproduce, then open a new issue with a detailed list of steps required to reproduce the problem, and also full details such as Atom version, output of git --version etc. It's practically impossible for us to help you based on your comment.

This is still happening to me, even with autocrlf set to false.

Correction: it works if i set autocrlf to false, delete the repo and clone once more.

This really does feel like a workaround and not a fix. Especially considering that the treeview detects changes just fine. Any chance to get this fixed?