Hideki IWAMOTO <hideki.iwamoto@gaia.eonet.ne.jp>

Patch Suggested
r1427278, r1426762, r1426752 r1427210, r1427197

r1427278 | rhuijben | 2012-12-31 20:03:35 -0600 (Mon, 31 Dec 2012)

Resolve another issue in the diff code when using full whitespace

Patch by: Hideki IWAMOTO <hideki.iwamoto{_AT_}gaia.eonet.ne.jp>
(issue confirmed and patch tweaked by me)

* subversion/libsvn_diff/diff_file.c
  (CHUNK_SHIFT): Add a cross-reference to test_token_compare().
  (token_compare): Adjust the number of bytes to read to handle whitespace
    skipping at the start of the token.

* subversion/tests/libsvn_diff/diff-diff3-test.c
  (test_token_compare): New test.
  (test_funcs): Add test.

r1427210 | rhuijben | 2012-12-31 12:07:29 -0600 (Mon, 31 Dec 2012)

Following up on r1427197, apply a similar fix to the suffix scanning. Avoid
updating variables until they are known to be correct to allow breaking out
of the loop. And reset state variables after detecting a common suffix. Part
of issue #4270.

Just like r1427197, the only behavior change should be in resetting the
state variables.

* subversion/libsvn_diff/diff_file.c
  (find_identical_suffix): Update loops and loop conditions to allow resetting
    state variables.

Suggested by: Hideki IWAMOTO <hideki.iwamoto{_AT_}gaia.eonet.ne.jp>

r1427197 | rhuijben | 2012-12-31 11:40:25 -0600 (Mon, 31 Dec 2012)

Resolve an issue in the indentical prefix detector of the diff library where
the last character is CR should have been reset. (Part of issue #4270)

Avoid a delta variable update by adding code to break both loops at once.
Before this patch the next outer loop would increase delta and then break.

* subversion/libsvn_diff/diff_file.c
  (find_identical_prefix): Reset had_cr after skipping.

Suggested by: Hideki IWAMOTO <hideki.iwamoto{_AT_}gaia.eonet.ne.jp>

r1426762 | rhuijben | 2012-12-29 07:46:56 -0600 (Sat, 29 Dec 2012)

Make sure that the diff suffix scanning optimization works correctly on
chunk boundaries. We accidentally skipped over the suffix start location
when that was a linebreak.

Slightly tweaked version of a
Patch by: Hideki IWAMOTO <h-iwamoto{_AT-}kit.hi-ho.ne.jp>

* subversion/libsvn_diff/diff_file.c
  (datasource_get_next_token): When at the end of a chunk, check if the next
    chunk should be ignored for the suffix filtering. Add comment where we
    actually jump to the next chunk.

* subversion/tests/libsvn_diff/diff-diff3-test.c
  (test_identical_suffix): New test.
  (test_funcs): Add test.

r1426752 | rhuijben | 2012-12-29 06:25:49 -0600 (Sat, 29 Dec 2012)

Fix a whitespace normalization issue in the diff code, identified by Hideki
Iwamoto. This applies patch applies the same fix as applied by steveking in
r876890 on the other whitespace normalization function invocation.

If the normalized offset is set incorrectly, reading back tokens from older
chunks for diff-matching when the hash value of two tokens is identical,
is broken.

This is a slightly reworked version of the
Patch by: Hideki IWAMOTO <h-iwamoto{_AT-}kit.hi-ho.ne.jp>

* subversion/libsvn_diff/diff_file.c
  (datasource_get_next_token): Set the normalized offset earlier to allow
    updating the offset later by each of the possibly two normalization passes.

* subversion/tests/libsvn_diff/diff-diff3-test.c
  (test_wrap): Rename existing test to ...
  (test_norm_offset): ... and test the specific issue identified here.
  (test_funcs): Update reference and expect the test to pass now.