murex / TCR

TCR (Test && Commit || Revert) utility
MIT License
43 stars 4 forks source link

[Bug]: Wrong behavior when adding or removing a space in a string #705

Closed mengdaming closed 2 weeks ago

mengdaming commented 2 weeks ago

Contact Details

damien.menanteau@gmail.com

Describe the bug

When adding (or removing) a space to (from) a string value, TCR does not commit the changes at the end of its cycle.

To Reproduce

Steps to reproduce the behavior:

  1. Start TCR
  2. Start driver mode
  3. Add a space character to a string litteral in one of the production or test files, in such a way that all tests can pass
  4. Save the file
  5. This triggers a TCR cycle
  6. After build and tests have passed, TCR indicates that it won't commit any change because it considers that no files were changed since last commit.

Expected behavior

TCR should create a new commit with the added (or removed) space

Working Environment

  1. OS: Any
  2. Observed on TCR version 1.1.0, although the problem should be the same with earlier versions

Additional Context

This problem is a consequence of TCR using the option --ignore-all-space when running git diff. The original intent was to prevent TCR from commiting meaningless changes such as reformating, re-indenting, line-trailing spaces, etc, overlooking the possibility of having impactful space characters changes. Proposal is to no longer use this flag when running git diff in order to clear this bug. Side effect will be that TCR may add extra commits that do not change the behaviour of the code.

Code of Conduct