Atom changes lines that I haven't touched so git finds changes that aren't really changes


#1

I make changes to a source controlled file in atom, but then git is finding that 50% of the lines in the file have changed even though I haven’t touched them. This is a pain because I often need to diff commits to debug and the git log is showing that most of the lines have changed between commits instead of just the lines that I have actually modified. It also means that I get conflicts on things that I haven’t changed.

I presume atom is doing something clever like converting tabs to spaces or something like that (most of the files will have been made in a different text editor initially). Does anyone know if there is a way of turning this off? It doesn’t happen in any of the other editors we use.


#2

Unless you’re using the tabs-to-spaces package, Atom does not convert tabs/spaces. But the bundled whitespace package does by default remove trailing whitespace when a file is saved, and it ensures an EOF newline. You can disable this in the package’s preferences (or manually in your config.cson file).


Modifying a line in a GIT repo creates several git diff entries
#3

Cheers Thomas, I think that has fixed it


#4

@thomasjo - could please give the syntax to disable the whitespace package completely? The current config.cson looks like

“*”:
“autocomplete-python”:
useKite: false
core:
telemetryConsent: “limited”
“exception-reporting”:
userId: “80192a1d-586e-41cf-932b-d9d9b540f33c”

Do i need to append something like:

“*”:
whitespace:
removeTrailingWhitespace: false


#6

The easiest way is to press the Disable button on the whitespace card in the Packages tab. The package does things other than remove extra whitespace, though, so probably what you want to do is disable the one feature.

Do i need to append something like:

“*”:
whitespace:
removeTrailingWhitespace: false

You don’t append it. The "*" key indicates that it goes under that key, so you would end up with

"*":
  "autocomplete-python":
    useKite: false
  core:
    telemetryConsent: "limited"
  "exception-reporting":
    userId: "80192a1d-586e-41cf-932b-d9d9b540f33c"
  whitespace:
    removeTrailingWhitespace: false

P.S. I think you should use Kite for autocomplete-python. I use it and it gives me so much information about what I’m writing.