Fossil

Changes On Branch long-diff-fix
Login

Changes On Branch long-diff-fix

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch long-diff-fix Excluding Merge-Ins

This is equivalent to a diff from a402dd2a to 54adcdb2

2024-01-07
17:26
Back out [a402dd2a888d6d74] (wiki title search), as it causes all searches to fail for reasons as yet undetermined. ... (check-in: 48af08bd user: stephan tags: trunk)
2023-12-07
19:57
Improvements to the diff algorithm. See forum thread 515e0d43425d7164 for discussion. ... (check-in: a45c7f0a user: drh tags: trunk)
2023-11-14
21:29
Move an invariable test outside a while loop. ... (check-in: b87bd729 user: danield tags: trunk)
20:17
Add search for help pages. ... (check-in: f0b96089 user: preben tags: search-help-pages)
19:38
Add test case for side-by-side xdiff. ... (Closed-Leaf check-in: 54adcdb2 user: preben tags: long-diff-fix)
19:11
Looping over too many triples also seems theoretically possible in contextDiff(). ... (check-in: 8ba47b1c user: preben tags: long-diff-fix)
19:03
An extra long diff may occur in side-by-side or html mode as discussed in [forum post 49cc60131b](https://fossil-scm.org/forum/forumpost/49cc60131b).

When enumerating mxr triples, looping over multiple triples may exceed mxr. ... (check-in: 3c9472e5 user: preben tags: long-diff-fix)

16:14
Enable searching of wiki titles. ... (check-in: a402dd2a user: preben tags: trunk)
2023-11-13
07:40
Fix usage wording for the branch command. ... (check-in: 8e8d1f06 user: danield tags: trunk)
2023-09-26
10:20
Generate output at the end of get_stext_by_mimetype() instead of within conditional branches. ... (Closed-Leaf check-in: 3105a0c5 user: preben tags: search-wiki-titles)

Changes to src/diff.c.

420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
  A = p->aFrom;
  B = p->aTo;
  R = p->aEdit;
  mxr = p->nEdit;
  while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; }
  for(r=0; r<mxr; r += 3*nr){
    /* Figure out how many triples to show in a single block */
    for(nr=1; R[r+nr*3]>0 && R[r+nr*3]<nContext*2; nr++){}
    /* printf("r=%d nr=%d\n", r, nr); */

    /* For the current block comprising nr triples, figure out
    ** how many lines of A and B are to be displayed
    */
    if( R[r]>nContext ){
      na = nb = nContext;







|







420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
  A = p->aFrom;
  B = p->aTo;
  R = p->aEdit;
  mxr = p->nEdit;
  while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; }
  for(r=0; r<mxr; r += 3*nr){
    /* Figure out how many triples to show in a single block */
    for(nr=1; 3*nr<mxr && R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){}
    /* printf("r=%d nr=%d\n", r, nr); */

    /* For the current block comprising nr triples, figure out
    ** how many lines of A and B are to be displayed
    */
    if( R[r]>nContext ){
      na = nb = nContext;
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
  B = p->aTo;
  R = p->aEdit;
  mxr = p->nEdit;
  while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; }

  for(r=0; r<mxr; r += 3*nr){
    /* Figure out how many triples to show in a single block */
    for(nr=1; R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){}

    /* If there is a regex, skip this block (generate no diff output)
    ** if the regex matches or does not match both insert and delete.
    ** Only display the block if one side matches but the other side does
    ** not.
    */
    if( pCfg->pRe ){







|







2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
  B = p->aTo;
  R = p->aEdit;
  mxr = p->nEdit;
  while( mxr>2 && R[mxr-1]==0 && R[mxr-2]==0 ){ mxr -= 3; }

  for(r=0; r<mxr; r += 3*nr){
    /* Figure out how many triples to show in a single block */
    for(nr=1; 3*nr<mxr && R[r+nr*3]>0 && R[r+nr*3]<(int)nContext*2; nr++){}

    /* If there is a regex, skip this block (generate no diff output)
    ** if the regex matches or does not match both insert and delete.
    ** Only display the block if one side matches but the other side does
    ** not.
    */
    if( pCfg->pRe ){

Changes to test/diff.test.

106
107
108
109
110
111
112


















113
114
115
116
fossil diff file5.dat

test diff-file5-1 {[normalize_result] eq {Index: file5.dat
==================================================================
--- file5.dat
+++ file5.dat
cannot compute difference between binary files}}



















###############################################################################

test_cleanup







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
fossil diff file5.dat

test diff-file5-1 {[normalize_result] eq {Index: file5.dat
==================================================================
--- file5.dat
+++ file5.dat
cannot compute difference between binary files}}

###############################################################################

write_file file6a.dat "{\n \"abc\": {\n  \"def\": false,\n  \"ghi\": false\n }\n}\n"
write_file file6b.dat "{\n \"abc\": {\n  \"def\": false,\n  \"ghi\": false\n },\n \"jkl\": {\n  \"mno\": {\n   \"pqr\": false\n  }\n }\n}\n"
fossil xdiff -y -W 16 file6a.dat file6b.dat
test diff-file-6-1 {[normalize_result] eq {========== file6a.dat ===== versus ===== file6b.dat =====
     1 {                       1 {
     2  "abc": {               2  "abc": {
     3   "def": false,         3   "def": false,
     4   "ghi": false          4   "ghi": false
                        >      5  },
                        >      6  "jkl": {
                        >      7   "mno": {
                        >      8    "pqr": false
                        >      9   }
     5  }                     10  }
     6 }                      11 }}}

###############################################################################

test_cleanup