Skip to content

2022 03 19 default value for word diff regex

Sebastien edited this page Mar 21, 2022 · 1 revision

default value for --word-diff-regex

  • Status: accepted
  • Date: 2022-03-19

Technical Story:

Context and Problem Statement

--ignore-whitespace, -W params have been not working since git changed the behaviour of --word-diff-regex behaviour. The generated delta does not filter whitespace changes only because git diff --name-status does not consider whitespace ignoring parameters.

Decision Drivers

  • Fix the --ignore-whitespace, -W params
  • Performance
  • Maintainability

Considered Options

  • Option 1 - Set the default value, use --name-status and diff each files
  • Option 2 - Set the default value, use --numstat and --diff-filter

Decision Outcome

Chosen option: "Option 2", because of performance impact and simple refactoring

Positive Consequences

  • --ignore-whitespace, -W params is fixed
  • --word-diff-regex behaviour is fixed, it is not possible to have discrepancy based on .gitattributes or .git/config
  • performance are still good

Negative Consequences

  • --word-diff-regex behaviour is fixed, it is not possible to drive it based on .gitattributes or .git/config
  • Maintenance is a little bit harder, we now have 3 call to git (One for Added/Modified/Deleted)

Pros and Cons of the Options

{option 1}

  • Good, we still use name-status
  • Bad, we have to diff each file with ignore white space git diff parameter and detect the one with no changes
  • Bad, performance drops

{option 2}

  • Good, easy refactoring
  • Good, few impact on performance
  • Bad, 3 calls for Added, Modified and Deleted git diff filter

Links