stable

Clone or download

Read-only

fix request #30403 Replacing 0.000 by 0 produce an empty diff

In FileUniDiffBuilder, we were checking that the result of the substr[0] function is false. When the content if the file is 0, it evaluates to false since the 0 is a falsey value. Given that substr returns an empty string if there is no content at the given index, we can drop this check. How to test: - Create a file containing a line whose content is "0.000" - Commit it and push to master - Create a pullrequest in which you update the previous line from "0.000" to "0" - Push your barnch and create a PR bewteen your branch and master - Open the diff in the PR --> 0.000 has been replaced by 0 [0] https://www.php.net/manual/fr/function.substr.php Change-Id: I564d292bdfc163df541cbbfb95b1347587f5e647

Modified Files

Name
M plugins/pullrequest/include/PullRequest/FileUniDiffBuilder.php +0 −3 Go to diff View file
M plugins/pullrequest/tests/unit/FileUniDiffBuilderTest.php +19 −12 Go to diff View file