commit 10ae3a65609c50cc21f975749f15afdcdc514126 from: Neels Hofmeyr date: Sat Oct 24 01:38:21 2020 UTC patience debug commit - a5de2633143c41b5d79b996d2b8f64df0808eaeb commit + 10ae3a65609c50cc21f975749f15afdcdc514126 blob - b9fcc7dfe751a48b4f3febe2cda52c45cc6288f2 blob + 1d0c6fd4faa11438034964c34bfb319969e36bff --- lib/diff_main.c +++ lib/diff_main.c @@ -302,8 +302,13 @@ diff_state_add_chunk(struct diff_state *state, bool so if (!solved || state->temp_result.len) { /* Append to temp_result */ - debug("append to temp_result\n"); result = &state->temp_result; + debug("append to temp_result %p L %u R %u\n", result, + left_count, right_count); + debug("L\n"); + debug_dump_atoms(&state->left, left_start, left_count); + debug("R\n"); + debug_dump_atoms(&state->right, right_start, right_count); } else if (!state->result->chunks.len) { /* Append to final result */ result = &state->result->chunks; blob - 0c983c45b9f23e0e1e04094533004da12a66192a blob + 468ef9d7d3976ca47d6bf7a7f942dde403e501ad --- lib/diff_patience.c +++ lib/diff_patience.c @@ -369,11 +369,12 @@ diff_atoms_swallow_identical_neighbors(struct diff_dat if (!PATIENCE(l).unique_in_both) continue; - debug("check identical lines around "); - debug_dump_atom(left, right, l); + debug("check identical lines around\n"); + debug(" L "); debug_dump_atom(left, right, l); unsigned int r_idx = diff_atom_idx(right, PATIENCE(l).pos_in_other); r = &right->atoms.head[r_idx]; + debug(" R "); debug_dump_atom(right, left, r); struct diff_range identical_l; struct diff_range identical_r; @@ -583,6 +584,16 @@ diff_algo_patience(const struct diff_algo_config *algo PATIENCE(atom).prev_stack = target_stack ? patience_stacks[target_stack - 1] : NULL; + { + int xx; + for (xx = 0; xx < patience_stacks_count; xx++) { + debug(" %s%d", + (xx == target_stack) ? ">" : "", + diff_atom_idx(right, + PATIENCE(patience_stacks[xx]).pos_in_other)); + } + debug("\n"); + } } /* backtrace through prev_stack references to form the final @@ -607,7 +618,9 @@ diff_algo_patience(const struct diff_algo_config *algo if (DEBUG) { debug("\npatience LCS:\n"); for (i = 0; i < lcs_count; i++) { - debug_dump_atom(left, right, lcs[i]); + debug("\n L "); debug_dump_atom(left, right, lcs[i]); + debug(" R "); debug_dump_atom(right, left, + PATIENCE(lcs[i]).pos_in_other); } } @@ -640,6 +653,9 @@ diff_algo_patience(const struct diff_algo_config *algo unsigned int left_idx; unsigned int right_idx; + debug("iteration %u of %u left_pos %u right_pos %u\n", + i, lcs_count, left_pos, right_pos); + if (i < lcs_count) { atom = lcs[i]; atom_r = PATIENCE(atom).pos_in_other;