Fossil SCM
When one version of a file ends in a newline and the other does not, be sure to show that difference. Ticket [7541963870703f0].
Commit
d764f449d78f9882a9034ed08f99138ef8ff5ea4
Parent
233463c4ec13c1b…
1 file changed
+6
-2
+6
-2
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -154,11 +154,11 @@ | ||
| 154 | 154 | for(i=0; i<nLine; i++){ |
| 155 | 155 | a[i].z = z; |
| 156 | 156 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 157 | 157 | k = j; |
| 158 | 158 | while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 159 | - for(h=0, x=0; x<k; x++){ | |
| 159 | + for(h=0, x=0; x<=k; x++){ | |
| 160 | 160 | h = h ^ (h<<2) ^ z[x]; |
| 161 | 161 | } |
| 162 | 162 | a[i].h = h = (h<<LENGTH_MASK_SZ) | k;; |
| 163 | 163 | h2 = h % nLine; |
| 164 | 164 | a[i].iNext = a[h2].iHash; |
| @@ -787,11 +787,15 @@ | ||
| 787 | 787 | if( nPrefix+nSuffix==nLeft ){ |
| 788 | 788 | sbsWriteLineno(p, lnLeft); |
| 789 | 789 | p->iStart2 = p->iEnd2 = 0; |
| 790 | 790 | p->iStart = p->iEnd = -1; |
| 791 | 791 | sbsWriteText(p, pLeft, SBS_PAD); |
| 792 | - sbsWrite(p, nLeft==nRight ? " " : " | ", 3); | |
| 792 | + if( nLeft==nRight && zLeft[nLeft]==zRight[nRight] ){ | |
| 793 | + sbsWrite(p, " ", 3); | |
| 794 | + }else{ | |
| 795 | + sbsWrite(p, " | ", 3); | |
| 796 | + } | |
| 793 | 797 | sbsWriteLineno(p, lnRight); |
| 794 | 798 | p->iStart = nPrefix; |
| 795 | 799 | p->iEnd = nRight - nSuffix; |
| 796 | 800 | p->zStart = zClassAdd; |
| 797 | 801 | sbsWriteText(p, pRight, SBS_NEWLINE); |
| 798 | 802 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -154,11 +154,11 @@ | |
| 154 | for(i=0; i<nLine; i++){ |
| 155 | a[i].z = z; |
| 156 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 157 | k = j; |
| 158 | while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 159 | for(h=0, x=0; x<k; x++){ |
| 160 | h = h ^ (h<<2) ^ z[x]; |
| 161 | } |
| 162 | a[i].h = h = (h<<LENGTH_MASK_SZ) | k;; |
| 163 | h2 = h % nLine; |
| 164 | a[i].iNext = a[h2].iHash; |
| @@ -787,11 +787,15 @@ | |
| 787 | if( nPrefix+nSuffix==nLeft ){ |
| 788 | sbsWriteLineno(p, lnLeft); |
| 789 | p->iStart2 = p->iEnd2 = 0; |
| 790 | p->iStart = p->iEnd = -1; |
| 791 | sbsWriteText(p, pLeft, SBS_PAD); |
| 792 | sbsWrite(p, nLeft==nRight ? " " : " | ", 3); |
| 793 | sbsWriteLineno(p, lnRight); |
| 794 | p->iStart = nPrefix; |
| 795 | p->iEnd = nRight - nSuffix; |
| 796 | p->zStart = zClassAdd; |
| 797 | sbsWriteText(p, pRight, SBS_NEWLINE); |
| 798 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -154,11 +154,11 @@ | |
| 154 | for(i=0; i<nLine; i++){ |
| 155 | a[i].z = z; |
| 156 | for(j=0; z[j] && z[j]!='\n'; j++){} |
| 157 | k = j; |
| 158 | while( ignoreWS && k>0 && fossil_isspace(z[k-1]) ){ k--; } |
| 159 | for(h=0, x=0; x<=k; x++){ |
| 160 | h = h ^ (h<<2) ^ z[x]; |
| 161 | } |
| 162 | a[i].h = h = (h<<LENGTH_MASK_SZ) | k;; |
| 163 | h2 = h % nLine; |
| 164 | a[i].iNext = a[h2].iHash; |
| @@ -787,11 +787,15 @@ | |
| 787 | if( nPrefix+nSuffix==nLeft ){ |
| 788 | sbsWriteLineno(p, lnLeft); |
| 789 | p->iStart2 = p->iEnd2 = 0; |
| 790 | p->iStart = p->iEnd = -1; |
| 791 | sbsWriteText(p, pLeft, SBS_PAD); |
| 792 | if( nLeft==nRight && zLeft[nLeft]==zRight[nRight] ){ |
| 793 | sbsWrite(p, " ", 3); |
| 794 | }else{ |
| 795 | sbsWrite(p, " | ", 3); |
| 796 | } |
| 797 | sbsWriteLineno(p, lnRight); |
| 798 | p->iStart = nPrefix; |
| 799 | p->iEnd = nRight - nSuffix; |
| 800 | p->zStart = zClassAdd; |
| 801 | sbsWriteText(p, pRight, SBS_NEWLINE); |
| 802 |