top | item 39589286

(no title)

radiospiel | 2 years ago

At least for whitespace changes git should have you covered

--ignore-space-at-eol Ignore changes in whitespace at EOL.

-b --ignore-space-change Ignore changes in amount of whitespace. This ignores whitespace at line end, and considers all other sequences of one or more whitespace characters to be equivalent.

-w --ignore-all-space Ignore whitespace when comparing lines. This ignores differences even if one line has whitespace where the other line has none.

--ignore-blank-lines

discuss

order

hawski|2 years ago

I will play a devil's advocate.

What about white space sensitive language like Python (that's one of things I hate about the language)?

Diff also gets easily confused, because its context window is pretty small.

hnfong|2 years ago

I'm repeating my comment in a sibling thread, but I think it's worth repeating (paraphrasing) -

(A) If the thing you have in mind can be inferred by looking at two commits, then you don't have to record the intention of the changes into the version control system because you can compute it later when needed.

(B) If the thing you have in mind can't be reliably inferred by looking at two commits, then you need some other way to tell the version control system about your intention.

For example, if you're just re-indenting a python source file, are you going to:

1. expect the system to automatically/heuristically realize you're just re-indenting it --> see (A)

2. explicitly tell the system that you've reindented it when making the commit --> are you sure you're bothered to do that?

3. Consistently and exclusively use a specialized IDE that records all your actions and transforms it to the corresponding intentions as recognized by the version control system?

pjc50|2 years ago

There are alternate diff algorithms that can be selected within even standard git diff. It's just stuck on the traditional one as the default.