Fossil SCM

Begin adding value that used to be function arguments into the DiffConfig object. This check-in deals with the pRe parameter.

drh 2021-09-06 20:51 diff-config
Commit bdb4bfaa3a69bdf3129c8f7f2353e20db1971a258486fcaf0791015ca01ce500
+1 -1
--- src/ajax.c
+++ src/ajax.c
@@ -155,11 +155,11 @@
155155
void ajax_render_diff(Blob * pOrig, Blob *pContent, u64 diffFlags){
156156
Blob out = empty_blob;
157157
DiffConfig DCfg;
158158
159159
diff_config_init(&DCfg, diffFlags);
160
- text_diff(pOrig, pContent, &out, 0, &DCfg);
160
+ text_diff(pOrig, pContent, &out, &DCfg);
161161
if(blob_size(&out)==0){
162162
/* nothing to do */
163163
}else if(DIFF_SIDEBYSIDE & diffFlags){
164164
CX("%b",&out);
165165
}else{
166166
--- src/ajax.c
+++ src/ajax.c
@@ -155,11 +155,11 @@
155 void ajax_render_diff(Blob * pOrig, Blob *pContent, u64 diffFlags){
156 Blob out = empty_blob;
157 DiffConfig DCfg;
158
159 diff_config_init(&DCfg, diffFlags);
160 text_diff(pOrig, pContent, &out, 0, &DCfg);
161 if(blob_size(&out)==0){
162 /* nothing to do */
163 }else if(DIFF_SIDEBYSIDE & diffFlags){
164 CX("%b",&out);
165 }else{
166
--- src/ajax.c
+++ src/ajax.c
@@ -155,11 +155,11 @@
155 void ajax_render_diff(Blob * pOrig, Blob *pContent, u64 diffFlags){
156 Blob out = empty_blob;
157 DiffConfig DCfg;
158
159 diff_config_init(&DCfg, diffFlags);
160 text_diff(pOrig, pContent, &out, &DCfg);
161 if(blob_size(&out)==0){
162 /* nothing to do */
163 }else if(DIFF_SIDEBYSIDE & diffFlags){
164 CX("%b",&out);
165 }else{
166
+18 -16
--- src/diff.c
+++ src/diff.c
@@ -90,11 +90,15 @@
9090
** * Number of lines of context surrounding each difference block
9191
**
9292
** * Width of output columns for text side-by-side diffop
9393
*/
9494
struct DiffConfig {
95
- u64 diffFlags; /* Legacy diff flags */
95
+ u64 diffFlags; /* Diff flags */
96
+ u32 nFile; /* Number of files diffed so far */
97
+ const char *zDiffCmd; /* External diff command to use instead of builtin */
98
+ const char *zBinGlob; /* GLOB pattern for binary files */
99
+ ReCompiled *pRe; /* Show only changes matching this pattern */
96100
};
97101
98102
#endif /* INTERFACE */
99103
100104
/*
@@ -1969,11 +1973,10 @@
19691973
/*
19701974
** Format a diff using a DiffBuilder object
19711975
*/
19721976
static void formatDiff(
19731977
DContext *p, /* The computed diff */
1974
- ReCompiled *pRe, /* Only show changes that match this regex */
19751978
DiffConfig *pCfg, /* Configuration options */
19761979
DiffBuilder *pBuilder /* The formatter object */
19771980
){
19781981
const DLine *A; /* Left side of the diff */
19791982
const DLine *B; /* Right side of the diff */
@@ -2003,19 +2006,19 @@
20032006
/* If there is a regex, skip this block (generate no diff output)
20042007
** if the regex matches or does not match both insert and delete.
20052008
** Only display the block if one side matches but the other side does
20062009
** not.
20072010
*/
2008
- if( pRe ){
2011
+ if( pCfg->pRe ){
20092012
int hideBlock = 1;
20102013
int xa = a, xb = b;
20112014
for(i=0; hideBlock && i<nr; i++){
20122015
int c1, c2;
20132016
xa += R[r+i*3];
20142017
xb += R[r+i*3];
2015
- c1 = re_dline_match(pRe, &A[xa], R[r+i*3+1]);
2016
- c2 = re_dline_match(pRe, &B[xb], R[r+i*3+2]);
2018
+ c1 = re_dline_match(pCfg->pRe, &A[xa], R[r+i*3+1]);
2019
+ c2 = re_dline_match(pCfg->pRe, &B[xb], R[r+i*3+2]);
20172020
hideBlock = c1==c2;
20182021
xa += R[r+i*3+1];
20192022
xb += R[r+i*3+2];
20202023
}
20212024
if( hideBlock ){
@@ -2620,16 +2623,16 @@
26202623
*/
26212624
int *text_diff(
26222625
Blob *pA_Blob, /* FROM file */
26232626
Blob *pB_Blob, /* TO file */
26242627
Blob *pOut, /* Write diff here if not NULL */
2625
- ReCompiled *pRe, /* Only output changes where this Regexp matches */
26262628
DiffConfig *pCfg /* Configuration options */
26272629
){
26282630
int ignoreWs; /* Ignore whitespace */
26292631
DContext c;
26302632
2633
+ pCfg->nFile++;
26312634
if( pCfg->diffFlags & DIFF_INVERT ){
26322635
Blob *pTemp = pA_Blob;
26332636
pA_Blob = pB_Blob;
26342637
pB_Blob = pTemp;
26352638
}
@@ -2703,29 +2706,29 @@
27032706
blob_appendf(pOut, " copy %6d delete %6d insert %6d\n",
27042707
R[r], R[r+1], R[r+2]);
27052708
}
27062709
}else if( pCfg->diffFlags & DIFF_JSON ){
27072710
DiffBuilder *pBuilder = dfjsonNew(pOut);
2708
- formatDiff(&c, pRe, pCfg, pBuilder);
2711
+ formatDiff(&c, pCfg, pBuilder);
27092712
blob_append_char(pOut, '\n');
27102713
}else if( pCfg->diffFlags & DIFF_TCL ){
27112714
DiffBuilder *pBuilder = dftclNew(pOut);
2712
- formatDiff(&c, pRe, pCfg, pBuilder);
2715
+ formatDiff(&c, pCfg, pBuilder);
27132716
}else if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
27142717
DiffBuilder *pBuilder;
27152718
if( pCfg->diffFlags & DIFF_HTML ){
27162719
pBuilder = dfsplitNew(pOut);
27172720
}else{
27182721
pBuilder = dfsbsNew(pOut, pCfg);
27192722
}
2720
- formatDiff(&c, pRe, pCfg, pBuilder);
2723
+ formatDiff(&c, pCfg, pBuilder);
27212724
}else if( pCfg->diffFlags & DIFF_DEBUG ){
27222725
DiffBuilder *pBuilder = dfdebugNew(pOut);
2723
- formatDiff(&c, pRe, pCfg, pBuilder);
2726
+ formatDiff(&c, pCfg, pBuilder);
27242727
}else if( pCfg->diffFlags & DIFF_HTML ){
27252728
DiffBuilder *pBuilder = dfunifiedNew(pOut);
2726
- formatDiff(&c, pRe, pCfg, pBuilder);
2729
+ formatDiff(&c, pCfg, pBuilder);
27272730
}else{
27282731
contextDiff(&c, pOut, pCfg);
27292732
}
27302733
fossil_free(c.aFrom);
27312734
fossil_free(c.aTo);
@@ -2840,36 +2843,35 @@
28402843
** still works, for compatibility.
28412844
*/
28422845
void xdiff_cmd(void){
28432846
Blob a, b, out;
28442847
const char *zRe; /* Regex filter for diff output */
2845
- ReCompiled *pRe = 0; /* Regex filter for diff output */
28462848
DiffConfig DCfg;
28472849
28482850
if( find_option("tk",0,0)!=0 ){
28492851
diff_tk("xdiff", 2);
28502852
return;
28512853
}
28522854
find_option("i",0,0);
28532855
find_option("v",0,0);
2856
+ diff_options(&DCfg, 0);
28542857
zRe = find_option("regexp","e",1);
28552858
if( zRe ){
2856
- const char *zErr = re_compile(&pRe, zRe, 0);
2859
+ const char *zErr = re_compile(&DCfg.pRe, zRe, 0);
28572860
if( zErr ) fossil_fatal("regex error: %s", zErr);
28582861
}
2859
- diff_options(&DCfg, 0);
28602862
verify_all_options();
28612863
if( g.argc!=4 ) usage("FILE1 FILE2");
28622864
blob_zero(&out);
28632865
diff_begin(&DCfg);
28642866
diff_print_filenames(g.argv[2], g.argv[3], &DCfg, &out);
28652867
blob_read_from_file(&a, g.argv[2], ExtFILE);
28662868
blob_read_from_file(&b, g.argv[3], ExtFILE);
2867
- text_diff(&a, &b, &out, pRe, &DCfg);
2869
+ text_diff(&a, &b, &out, &DCfg);
28682870
blob_write_to_file(&out, "-");
28692871
diff_end(&DCfg, 0);
2870
- re_free(pRe);
2872
+ re_free(DCfg.pRe);
28712873
}
28722874
28732875
/**************************************************************************
28742876
** The basic difference engine is above. What follows is the annotation
28752877
** engine. Both are in the same file since they share many components.
28762878
--- src/diff.c
+++ src/diff.c
@@ -90,11 +90,15 @@
90 ** * Number of lines of context surrounding each difference block
91 **
92 ** * Width of output columns for text side-by-side diffop
93 */
94 struct DiffConfig {
95 u64 diffFlags; /* Legacy diff flags */
 
 
 
 
96 };
97
98 #endif /* INTERFACE */
99
100 /*
@@ -1969,11 +1973,10 @@
1969 /*
1970 ** Format a diff using a DiffBuilder object
1971 */
1972 static void formatDiff(
1973 DContext *p, /* The computed diff */
1974 ReCompiled *pRe, /* Only show changes that match this regex */
1975 DiffConfig *pCfg, /* Configuration options */
1976 DiffBuilder *pBuilder /* The formatter object */
1977 ){
1978 const DLine *A; /* Left side of the diff */
1979 const DLine *B; /* Right side of the diff */
@@ -2003,19 +2006,19 @@
2003 /* If there is a regex, skip this block (generate no diff output)
2004 ** if the regex matches or does not match both insert and delete.
2005 ** Only display the block if one side matches but the other side does
2006 ** not.
2007 */
2008 if( pRe ){
2009 int hideBlock = 1;
2010 int xa = a, xb = b;
2011 for(i=0; hideBlock && i<nr; i++){
2012 int c1, c2;
2013 xa += R[r+i*3];
2014 xb += R[r+i*3];
2015 c1 = re_dline_match(pRe, &A[xa], R[r+i*3+1]);
2016 c2 = re_dline_match(pRe, &B[xb], R[r+i*3+2]);
2017 hideBlock = c1==c2;
2018 xa += R[r+i*3+1];
2019 xb += R[r+i*3+2];
2020 }
2021 if( hideBlock ){
@@ -2620,16 +2623,16 @@
2620 */
2621 int *text_diff(
2622 Blob *pA_Blob, /* FROM file */
2623 Blob *pB_Blob, /* TO file */
2624 Blob *pOut, /* Write diff here if not NULL */
2625 ReCompiled *pRe, /* Only output changes where this Regexp matches */
2626 DiffConfig *pCfg /* Configuration options */
2627 ){
2628 int ignoreWs; /* Ignore whitespace */
2629 DContext c;
2630
 
2631 if( pCfg->diffFlags & DIFF_INVERT ){
2632 Blob *pTemp = pA_Blob;
2633 pA_Blob = pB_Blob;
2634 pB_Blob = pTemp;
2635 }
@@ -2703,29 +2706,29 @@
2703 blob_appendf(pOut, " copy %6d delete %6d insert %6d\n",
2704 R[r], R[r+1], R[r+2]);
2705 }
2706 }else if( pCfg->diffFlags & DIFF_JSON ){
2707 DiffBuilder *pBuilder = dfjsonNew(pOut);
2708 formatDiff(&c, pRe, pCfg, pBuilder);
2709 blob_append_char(pOut, '\n');
2710 }else if( pCfg->diffFlags & DIFF_TCL ){
2711 DiffBuilder *pBuilder = dftclNew(pOut);
2712 formatDiff(&c, pRe, pCfg, pBuilder);
2713 }else if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
2714 DiffBuilder *pBuilder;
2715 if( pCfg->diffFlags & DIFF_HTML ){
2716 pBuilder = dfsplitNew(pOut);
2717 }else{
2718 pBuilder = dfsbsNew(pOut, pCfg);
2719 }
2720 formatDiff(&c, pRe, pCfg, pBuilder);
2721 }else if( pCfg->diffFlags & DIFF_DEBUG ){
2722 DiffBuilder *pBuilder = dfdebugNew(pOut);
2723 formatDiff(&c, pRe, pCfg, pBuilder);
2724 }else if( pCfg->diffFlags & DIFF_HTML ){
2725 DiffBuilder *pBuilder = dfunifiedNew(pOut);
2726 formatDiff(&c, pRe, pCfg, pBuilder);
2727 }else{
2728 contextDiff(&c, pOut, pCfg);
2729 }
2730 fossil_free(c.aFrom);
2731 fossil_free(c.aTo);
@@ -2840,36 +2843,35 @@
2840 ** still works, for compatibility.
2841 */
2842 void xdiff_cmd(void){
2843 Blob a, b, out;
2844 const char *zRe; /* Regex filter for diff output */
2845 ReCompiled *pRe = 0; /* Regex filter for diff output */
2846 DiffConfig DCfg;
2847
2848 if( find_option("tk",0,0)!=0 ){
2849 diff_tk("xdiff", 2);
2850 return;
2851 }
2852 find_option("i",0,0);
2853 find_option("v",0,0);
 
2854 zRe = find_option("regexp","e",1);
2855 if( zRe ){
2856 const char *zErr = re_compile(&pRe, zRe, 0);
2857 if( zErr ) fossil_fatal("regex error: %s", zErr);
2858 }
2859 diff_options(&DCfg, 0);
2860 verify_all_options();
2861 if( g.argc!=4 ) usage("FILE1 FILE2");
2862 blob_zero(&out);
2863 diff_begin(&DCfg);
2864 diff_print_filenames(g.argv[2], g.argv[3], &DCfg, &out);
2865 blob_read_from_file(&a, g.argv[2], ExtFILE);
2866 blob_read_from_file(&b, g.argv[3], ExtFILE);
2867 text_diff(&a, &b, &out, pRe, &DCfg);
2868 blob_write_to_file(&out, "-");
2869 diff_end(&DCfg, 0);
2870 re_free(pRe);
2871 }
2872
2873 /**************************************************************************
2874 ** The basic difference engine is above. What follows is the annotation
2875 ** engine. Both are in the same file since they share many components.
2876
--- src/diff.c
+++ src/diff.c
@@ -90,11 +90,15 @@
90 ** * Number of lines of context surrounding each difference block
91 **
92 ** * Width of output columns for text side-by-side diffop
93 */
94 struct DiffConfig {
95 u64 diffFlags; /* Diff flags */
96 u32 nFile; /* Number of files diffed so far */
97 const char *zDiffCmd; /* External diff command to use instead of builtin */
98 const char *zBinGlob; /* GLOB pattern for binary files */
99 ReCompiled *pRe; /* Show only changes matching this pattern */
100 };
101
102 #endif /* INTERFACE */
103
104 /*
@@ -1969,11 +1973,10 @@
1973 /*
1974 ** Format a diff using a DiffBuilder object
1975 */
1976 static void formatDiff(
1977 DContext *p, /* The computed diff */
 
1978 DiffConfig *pCfg, /* Configuration options */
1979 DiffBuilder *pBuilder /* The formatter object */
1980 ){
1981 const DLine *A; /* Left side of the diff */
1982 const DLine *B; /* Right side of the diff */
@@ -2003,19 +2006,19 @@
2006 /* If there is a regex, skip this block (generate no diff output)
2007 ** if the regex matches or does not match both insert and delete.
2008 ** Only display the block if one side matches but the other side does
2009 ** not.
2010 */
2011 if( pCfg->pRe ){
2012 int hideBlock = 1;
2013 int xa = a, xb = b;
2014 for(i=0; hideBlock && i<nr; i++){
2015 int c1, c2;
2016 xa += R[r+i*3];
2017 xb += R[r+i*3];
2018 c1 = re_dline_match(pCfg->pRe, &A[xa], R[r+i*3+1]);
2019 c2 = re_dline_match(pCfg->pRe, &B[xb], R[r+i*3+2]);
2020 hideBlock = c1==c2;
2021 xa += R[r+i*3+1];
2022 xb += R[r+i*3+2];
2023 }
2024 if( hideBlock ){
@@ -2620,16 +2623,16 @@
2623 */
2624 int *text_diff(
2625 Blob *pA_Blob, /* FROM file */
2626 Blob *pB_Blob, /* TO file */
2627 Blob *pOut, /* Write diff here if not NULL */
 
2628 DiffConfig *pCfg /* Configuration options */
2629 ){
2630 int ignoreWs; /* Ignore whitespace */
2631 DContext c;
2632
2633 pCfg->nFile++;
2634 if( pCfg->diffFlags & DIFF_INVERT ){
2635 Blob *pTemp = pA_Blob;
2636 pA_Blob = pB_Blob;
2637 pB_Blob = pTemp;
2638 }
@@ -2703,29 +2706,29 @@
2706 blob_appendf(pOut, " copy %6d delete %6d insert %6d\n",
2707 R[r], R[r+1], R[r+2]);
2708 }
2709 }else if( pCfg->diffFlags & DIFF_JSON ){
2710 DiffBuilder *pBuilder = dfjsonNew(pOut);
2711 formatDiff(&c, pCfg, pBuilder);
2712 blob_append_char(pOut, '\n');
2713 }else if( pCfg->diffFlags & DIFF_TCL ){
2714 DiffBuilder *pBuilder = dftclNew(pOut);
2715 formatDiff(&c, pCfg, pBuilder);
2716 }else if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
2717 DiffBuilder *pBuilder;
2718 if( pCfg->diffFlags & DIFF_HTML ){
2719 pBuilder = dfsplitNew(pOut);
2720 }else{
2721 pBuilder = dfsbsNew(pOut, pCfg);
2722 }
2723 formatDiff(&c, pCfg, pBuilder);
2724 }else if( pCfg->diffFlags & DIFF_DEBUG ){
2725 DiffBuilder *pBuilder = dfdebugNew(pOut);
2726 formatDiff(&c, pCfg, pBuilder);
2727 }else if( pCfg->diffFlags & DIFF_HTML ){
2728 DiffBuilder *pBuilder = dfunifiedNew(pOut);
2729 formatDiff(&c, pCfg, pBuilder);
2730 }else{
2731 contextDiff(&c, pOut, pCfg);
2732 }
2733 fossil_free(c.aFrom);
2734 fossil_free(c.aTo);
@@ -2840,36 +2843,35 @@
2843 ** still works, for compatibility.
2844 */
2845 void xdiff_cmd(void){
2846 Blob a, b, out;
2847 const char *zRe; /* Regex filter for diff output */
 
2848 DiffConfig DCfg;
2849
2850 if( find_option("tk",0,0)!=0 ){
2851 diff_tk("xdiff", 2);
2852 return;
2853 }
2854 find_option("i",0,0);
2855 find_option("v",0,0);
2856 diff_options(&DCfg, 0);
2857 zRe = find_option("regexp","e",1);
2858 if( zRe ){
2859 const char *zErr = re_compile(&DCfg.pRe, zRe, 0);
2860 if( zErr ) fossil_fatal("regex error: %s", zErr);
2861 }
 
2862 verify_all_options();
2863 if( g.argc!=4 ) usage("FILE1 FILE2");
2864 blob_zero(&out);
2865 diff_begin(&DCfg);
2866 diff_print_filenames(g.argv[2], g.argv[3], &DCfg, &out);
2867 blob_read_from_file(&a, g.argv[2], ExtFILE);
2868 blob_read_from_file(&b, g.argv[3], ExtFILE);
2869 text_diff(&a, &b, &out, &DCfg);
2870 blob_write_to_file(&out, "-");
2871 diff_end(&DCfg, 0);
2872 re_free(DCfg.pRe);
2873 }
2874
2875 /**************************************************************************
2876 ** The basic difference engine is above. What follows is the annotation
2877 ** engine. Both are in the same file since they share many components.
2878
+3 -3
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -430,13 +430,13 @@
430430
fossil_print("CHANGED %s\n", zName);
431431
}
432432
}else{
433433
blob_zero(&out);
434434
if( fSwapDiff ){
435
- text_diff(&file2, pFile1, &out, 0, pCfg);
435
+ text_diff(&file2, pFile1, &out, pCfg);
436436
}else{
437
- text_diff(pFile1, &file2, &out, 0, pCfg);
437
+ text_diff(pFile1, &file2, &out, pCfg);
438438
}
439439
if( blob_size(&out) ){
440440
if( pCfg->diffFlags & DIFF_NUMSTAT ){
441441
if( !diffBlob ){
442442
fossil_print("%s %s\n", blob_str(&out), zName);
@@ -541,11 +541,11 @@
541541
if( pCfg->diffFlags & DIFF_BRIEF ) return;
542542
if( zDiffCmd==0 ){
543543
Blob out; /* Diff output text */
544544
545545
blob_zero(&out);
546
- text_diff(pFile1, pFile2, &out, 0, pCfg);
546
+ text_diff(pFile1, pFile2, &out, pCfg);
547547
if( pCfg->diffFlags & DIFF_NUMSTAT ){
548548
fossil_print("%s %s\n", blob_str(&out), zName);
549549
}else{
550550
diff_print_filenames(zName, zName, pCfg, 0);
551551
fossil_print("%s\n", blob_str(&out));
552552
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -430,13 +430,13 @@
430 fossil_print("CHANGED %s\n", zName);
431 }
432 }else{
433 blob_zero(&out);
434 if( fSwapDiff ){
435 text_diff(&file2, pFile1, &out, 0, pCfg);
436 }else{
437 text_diff(pFile1, &file2, &out, 0, pCfg);
438 }
439 if( blob_size(&out) ){
440 if( pCfg->diffFlags & DIFF_NUMSTAT ){
441 if( !diffBlob ){
442 fossil_print("%s %s\n", blob_str(&out), zName);
@@ -541,11 +541,11 @@
541 if( pCfg->diffFlags & DIFF_BRIEF ) return;
542 if( zDiffCmd==0 ){
543 Blob out; /* Diff output text */
544
545 blob_zero(&out);
546 text_diff(pFile1, pFile2, &out, 0, pCfg);
547 if( pCfg->diffFlags & DIFF_NUMSTAT ){
548 fossil_print("%s %s\n", blob_str(&out), zName);
549 }else{
550 diff_print_filenames(zName, zName, pCfg, 0);
551 fossil_print("%s\n", blob_str(&out));
552
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -430,13 +430,13 @@
430 fossil_print("CHANGED %s\n", zName);
431 }
432 }else{
433 blob_zero(&out);
434 if( fSwapDiff ){
435 text_diff(&file2, pFile1, &out, pCfg);
436 }else{
437 text_diff(pFile1, &file2, &out, pCfg);
438 }
439 if( blob_size(&out) ){
440 if( pCfg->diffFlags & DIFF_NUMSTAT ){
441 if( !diffBlob ){
442 fossil_print("%s %s\n", blob_str(&out), zName);
@@ -541,11 +541,11 @@
541 if( pCfg->diffFlags & DIFF_BRIEF ) return;
542 if( zDiffCmd==0 ){
543 Blob out; /* Diff output text */
544
545 blob_zero(&out);
546 text_diff(pFile1, pFile2, &out, pCfg);
547 if( pCfg->diffFlags & DIFF_NUMSTAT ){
548 fossil_print("%s %s\n", blob_str(&out), zName);
549 }else{
550 diff_print_filenames(zName, zName, pCfg, 0);
551 fossil_print("%s\n", blob_str(&out));
552
+39 -33
--- src/info.c
+++ src/info.c
@@ -330,17 +330,15 @@
330330
** Append the difference between artifacts to the output
331331
*/
332332
static void append_diff(
333333
const char *zFrom, /* Diff from this artifact */
334334
const char *zTo, /* ... to this artifact */
335
- u64 diffFlags, /* Diff formatting flags */
336
- ReCompiled *pRe /* Only show change matching this regex */
335
+ DiffConfig *pCfg /* The diff configuration */
337336
){
338337
int fromid;
339338
int toid;
340339
Blob from, to;
341
- DiffConfig DCfg;
342340
if( zFrom ){
343341
fromid = uuid_to_rid(zFrom, 0);
344342
content_get(fromid, &from);
345343
}else{
346344
blob_zero(&from);
@@ -349,17 +347,16 @@
349347
toid = uuid_to_rid(zTo, 0);
350348
content_get(toid, &to);
351349
}else{
352350
blob_zero(&to);
353351
}
354
- if( diffFlags & DIFF_SIDEBYSIDE ){
355
- diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
352
+ if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
353
+ pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
356354
}else{
357
- diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
355
+ pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
358356
}
359
- diff_config_init(&DCfg, diffFlags);
360
- text_diff(&from, &to, cgi_output_blob(), pRe, &DCfg);
357
+ text_diff(&from, &to, cgi_output_blob(), pCfg);
361358
blob_reset(&from);
362359
blob_reset(&to);
363360
}
364361
365362
/*
@@ -370,12 +367,11 @@
370367
const char *zCkin, /* The checkin on which the change occurs */
371368
const char *zName, /* Name of the file that has changed */
372369
const char *zOld, /* blob.uuid before change. NULL for added files */
373370
const char *zNew, /* blob.uuid after change. NULL for deletes */
374371
const char *zOldName, /* Prior name. NULL if no name change. */
375
- u64 diffFlags, /* Flags for text_diff(). Zero to omit diffs */
376
- ReCompiled *pRe, /* Only show diffs that match this regex, if not NULL */
372
+ DiffConfig *pCfg, /* Flags for text_diff() or NULL to omit all */
377373
int mperm /* executable or symlink permission for zNew */
378374
){
379375
@ <p>
380376
if( !g.perm.Hyperlink ){
381377
if( zNew==0 ){
@@ -393,12 +389,12 @@
393389
@ %h(zName) became a regular file.
394390
}
395391
}else{
396392
@ Changes to %h(zName).
397393
}
398
- if( diffFlags ){
399
- append_diff(zOld, zNew, diffFlags, pRe);
394
+ if( pCfg ){
395
+ append_diff(zOld, zNew, pCfg);
400396
}
401397
}else{
402398
if( zOld && zNew ){
403399
if( fossil_strcmp(zOld, zNew)!=0 ){
404400
@ Modified %z(href("%R/finfo?name=%T&m=%!S&ci=%!S",zName,zNew,zCkin))\
@@ -428,12 +424,12 @@
428424
@ %h(zName)</a> version %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a>.
429425
}else{
430426
@ Added %z(href("%R/finfo?name=%T&m=%!S&ci=%!S",zName,zNew,zCkin))\
431427
@ %h(zName)</a> version %z(href("%R/artifact/%!S",zNew))[%S(zNew)]</a>.
432428
}
433
- if( diffFlags ){
434
- append_diff(zOld, zNew, diffFlags, pRe);
429
+ if( pCfg ){
430
+ append_diff(zOld, zNew, pCfg);
435431
}else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
436432
@ &nbsp;&nbsp;
437433
@ %z(href("%R/fdiff?v1=%!S&v2=%!S",zOld,zNew))[diff]</a>
438434
}
439435
}
@@ -450,11 +446,11 @@
450446
451447
/*
452448
** Construct an appropriate diffFlag for text_diff() based on query
453449
** parameters and the to boolean arguments.
454450
*/
455
-u64 construct_diff_flags(int diffType){
451
+DiffConfig *construct_diff_flags(int diffType, DiffConfig *pCfg){
456452
u64 diffFlags = 0; /* Zero means do not show any diff */
457453
if( diffType>0 ){
458454
int x;
459455
if( diffType==2 ){
460456
diffFlags = DIFF_SIDEBYSIDE;
@@ -474,12 +470,16 @@
474470
diffFlags += x;
475471
476472
/* The "noopt" parameter disables diff optimization */
477473
if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
478474
diffFlags |= DIFF_STRIP_EOLCR;
475
+ diff_config_init(pCfg, diffFlags);
476
+ return pCfg;
477
+ }else{
478
+ diff_config_init(pCfg, 0);
479
+ return 0;
479480
}
480
- return diffFlags;
481481
}
482482
483483
/*
484484
** WEBPAGE: ci_tags
485485
** URL: /ci_tags?name=ARTIFACTID
@@ -616,20 +616,20 @@
616616
void ci_page(void){
617617
Stmt q1, q2, q3;
618618
int rid;
619619
int isLeaf;
620620
int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
621
- u64 diffFlags; /* Flag parameter for text_diff() */
622621
const char *zName; /* Name of the check-in to be displayed */
623622
const char *zUuid; /* Hash of zName, found via blob.uuid */
624623
const char *zParent; /* Hash of the parent check-in (if any) */
625624
const char *zRe; /* regex parameter */
626625
ReCompiled *pRe = 0; /* regex */
627
- const char *zW; /* URL param for ignoring whitespace */
626
+ const char *zW; /* URL param for ignoring whitespace */
628627
const char *zPage = "vinfo"; /* Page that shows diffs */
629628
const char *zPageHide = "ci"; /* Page that hides diffs */
630
- const char *zBrName; /* Branch name */
629
+ const char *zBrName; /* Branch name */
630
+ DiffConfig DCfg,*pCfg; /* Type of diff */
631631
632632
login_check_credentials();
633633
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
634634
style_set_current_feature("vinfo");
635635
zName = P("name");
@@ -880,12 +880,13 @@
880880
render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
881881
@ <div class="section">Context</div>
882882
render_checkin_context(rid, 0, 0, 0);
883883
@ <div class="section">Changes</div>
884884
@ <div class="sectionmenu">
885
- diffFlags = construct_diff_flags(diffType);
886
- zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
885
+ pCfg = construct_diff_flags(diffType, &DCfg);
886
+ DCfg.pRe = pRe;
887
+ zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
887888
if( diffType!=0 ){
888889
@ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
889890
@ Hide&nbsp;Diffs</a>
890891
}
891892
if( diffType!=1 ){
@@ -935,14 +936,14 @@
935936
int mperm = db_column_int(&q3, 1);
936937
const char *zOld = db_column_text(&q3,2);
937938
const char *zNew = db_column_text(&q3,3);
938939
const char *zOldName = db_column_text(&q3, 4);
939940
append_file_change_line(zUuid, zName, zOld, zNew, zOldName,
940
- diffFlags,pRe,mperm);
941
+ pCfg,mperm);
941942
}
942943
db_finalize(&q3);
943
- append_diff_javascript(diffType==2);
944
+ append_diff_javascript(diffType);
944945
builtin_fossil_js_bundle_or("info-diff",NULL);
945946
style_finish_page();
946947
}
947948
948949
/*
@@ -1169,20 +1170,20 @@
11691170
** Show all differences between two check-ins.
11701171
*/
11711172
void vdiff_page(void){
11721173
int ridFrom, ridTo;
11731174
int diffType = 0; /* 0: none, 1: unified, 2: side-by-side */
1174
- u64 diffFlags = 0;
11751175
Manifest *pFrom, *pTo;
11761176
ManifestFile *pFileFrom, *pFileTo;
11771177
const char *zBranch;
11781178
const char *zFrom;
11791179
const char *zTo;
11801180
const char *zRe;
11811181
const char *zGlob;
11821182
char *zMergeOrigin = 0;
11831183
ReCompiled *pRe = 0;
1184
+ DiffConfig DCfg, *pCfg = 0;
11841185
int graphFlags = 0;
11851186
Blob qp;
11861187
int bInvert = PB("inv");
11871188
11881189
login_check_credentials();
@@ -1231,12 +1232,12 @@
12311232
}
12321233
if( PB("nc") ){
12331234
graphFlags |= TIMELINE_NOCOLOR;
12341235
blob_appendf(&qp, "&nc");
12351236
}
1236
- diffFlags = construct_diff_flags(diffType);
1237
- if( diffFlags & DIFF_IGNORE_ALLWS ){
1237
+ pCfg = construct_diff_flags(diffType, &DCfg);
1238
+ if( DCfg.diffFlags & DIFF_IGNORE_ALLWS ){
12381239
blob_appendf(&qp, "&w");
12391240
}
12401241
style_set_current_feature("vdiff");
12411242
if( zBranch==0 ){
12421243
style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
@@ -1255,11 +1256,11 @@
12551256
}
12561257
if( zGlob ){
12571258
style_submenu_element("Clear glob", "%R/vdiff?diff=%d&%b", diffType, &qp);
12581259
}else{
12591260
style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo,
1260
- (diffFlags & DIFF_IGNORE_ALLWS)?"&w":"");
1261
+ (DCfg.diffFlags & DIFF_IGNORE_ALLWS)?"&w":"");
12611262
}
12621263
if( diffType!=0 ){
12631264
style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
12641265
}
12651266
if( zBranch ){
@@ -1303,10 +1304,11 @@
13031304
13041305
manifest_file_rewind(pFrom);
13051306
pFileFrom = manifest_file_next(pFrom, 0);
13061307
manifest_file_rewind(pTo);
13071308
pFileTo = manifest_file_next(pTo, 0);
1309
+ DCfg.pRe = pRe;
13081310
while( pFileFrom || pFileTo ){
13091311
int cmp;
13101312
if( pFileFrom==0 ){
13111313
cmp = +1;
13121314
}else if( pFileTo==0 ){
@@ -1315,17 +1317,17 @@
13151317
cmp = fossil_strcmp(pFileFrom->zName, pFileTo->zName);
13161318
}
13171319
if( cmp<0 ){
13181320
if( !zGlob || sqlite3_strglob(zGlob, pFileFrom->zName)==0 ){
13191321
append_file_change_line(zFrom, pFileFrom->zName,
1320
- pFileFrom->zUuid, 0, 0, diffFlags, pRe, 0);
1322
+ pFileFrom->zUuid, 0, 0, pCfg, 0);
13211323
}
13221324
pFileFrom = manifest_file_next(pFrom, 0);
13231325
}else if( cmp>0 ){
13241326
if( !zGlob || sqlite3_strglob(zGlob, pFileTo->zName)==0 ){
13251327
append_file_change_line(zTo, pFileTo->zName,
1326
- 0, pFileTo->zUuid, 0, diffFlags, pRe,
1328
+ 0, pFileTo->zUuid, 0, pCfg,
13271329
manifest_file_mperm(pFileTo));
13281330
}
13291331
pFileTo = manifest_file_next(pTo, 0);
13301332
}else if( fossil_strcmp(pFileFrom->zUuid, pFileTo->zUuid)==0 ){
13311333
pFileFrom = manifest_file_next(pFrom, 0);
@@ -1333,11 +1335,11 @@
13331335
}else{
13341336
if(!zGlob || (sqlite3_strglob(zGlob, pFileFrom->zName)==0
13351337
|| sqlite3_strglob(zGlob, pFileTo->zName)==0) ){
13361338
append_file_change_line(zFrom, pFileFrom->zName,
13371339
pFileFrom->zUuid,
1338
- pFileTo->zUuid, 0, diffFlags, pRe,
1340
+ pFileTo->zUuid, 0, pCfg,
13391341
manifest_file_mperm(pFileTo));
13401342
}
13411343
pFileFrom = manifest_file_next(pFrom, 0);
13421344
pFileTo = manifest_file_next(pTo, 0);
13431345
}
@@ -1724,10 +1726,11 @@
17241726
const char *zRe;
17251727
ReCompiled *pRe = 0;
17261728
u64 diffFlags;
17271729
u32 objdescFlags = 0;
17281730
int verbose = PB("verbose");
1731
+ DiffConfig DCfg;
17291732
17301733
login_check_credentials();
17311734
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
17321735
diffType = preferred_diff_type();
17331736
if( P("from") && P("to") ){
@@ -1777,19 +1780,21 @@
17771780
cgi_set_content_type("text/plain");
17781781
diffFlags = 4;
17791782
content_get(v1, &c1);
17801783
content_get(v2, &c2);
17811784
diff_config_init(&DCfg, diffFlags);
1782
- text_diff(&c1, &c2, pOut, pRe, &DCfg);
1785
+ DCfg.pRe = pRe;
1786
+ text_diff(&c1, &c2, pOut, &DCfg);
17831787
blob_reset(&c1);
17841788
blob_reset(&c2);
17851789
return;
17861790
}
17871791
17881792
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
17891793
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1790
- diffFlags = construct_diff_flags(diffType) | DIFF_HTML;
1794
+ construct_diff_flags(diffType, &DCfg);
1795
+ DCfg.diffFlags |= DIFF_HTML;
17911796
17921797
style_set_current_feature("fdiff");
17931798
style_header("Diff");
17941799
style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
17951800
if( diffType==2 ){
@@ -1815,13 +1820,14 @@
18151820
object_description(v2, objdescFlags,0, 0);
18161821
}
18171822
if( pRe ){
18181823
@ <b>Only differences that match regular expression "%h(zRe)"
18191824
@ are shown.</b>
1825
+ DCfg.pRe = pRe;
18201826
}
18211827
@ <hr />
1822
- append_diff(zV1, zV2, diffFlags, pRe);
1828
+ append_diff(zV1, zV2, &DCfg);
18231829
append_diff_javascript(diffType);
18241830
style_finish_page();
18251831
}
18261832
18271833
/*
18281834
--- src/info.c
+++ src/info.c
@@ -330,17 +330,15 @@
330 ** Append the difference between artifacts to the output
331 */
332 static void append_diff(
333 const char *zFrom, /* Diff from this artifact */
334 const char *zTo, /* ... to this artifact */
335 u64 diffFlags, /* Diff formatting flags */
336 ReCompiled *pRe /* Only show change matching this regex */
337 ){
338 int fromid;
339 int toid;
340 Blob from, to;
341 DiffConfig DCfg;
342 if( zFrom ){
343 fromid = uuid_to_rid(zFrom, 0);
344 content_get(fromid, &from);
345 }else{
346 blob_zero(&from);
@@ -349,17 +347,16 @@
349 toid = uuid_to_rid(zTo, 0);
350 content_get(toid, &to);
351 }else{
352 blob_zero(&to);
353 }
354 if( diffFlags & DIFF_SIDEBYSIDE ){
355 diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
356 }else{
357 diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
358 }
359 diff_config_init(&DCfg, diffFlags);
360 text_diff(&from, &to, cgi_output_blob(), pRe, &DCfg);
361 blob_reset(&from);
362 blob_reset(&to);
363 }
364
365 /*
@@ -370,12 +367,11 @@
370 const char *zCkin, /* The checkin on which the change occurs */
371 const char *zName, /* Name of the file that has changed */
372 const char *zOld, /* blob.uuid before change. NULL for added files */
373 const char *zNew, /* blob.uuid after change. NULL for deletes */
374 const char *zOldName, /* Prior name. NULL if no name change. */
375 u64 diffFlags, /* Flags for text_diff(). Zero to omit diffs */
376 ReCompiled *pRe, /* Only show diffs that match this regex, if not NULL */
377 int mperm /* executable or symlink permission for zNew */
378 ){
379 @ <p>
380 if( !g.perm.Hyperlink ){
381 if( zNew==0 ){
@@ -393,12 +389,12 @@
393 @ %h(zName) became a regular file.
394 }
395 }else{
396 @ Changes to %h(zName).
397 }
398 if( diffFlags ){
399 append_diff(zOld, zNew, diffFlags, pRe);
400 }
401 }else{
402 if( zOld && zNew ){
403 if( fossil_strcmp(zOld, zNew)!=0 ){
404 @ Modified %z(href("%R/finfo?name=%T&m=%!S&ci=%!S",zName,zNew,zCkin))\
@@ -428,12 +424,12 @@
428 @ %h(zName)</a> version %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a>.
429 }else{
430 @ Added %z(href("%R/finfo?name=%T&m=%!S&ci=%!S",zName,zNew,zCkin))\
431 @ %h(zName)</a> version %z(href("%R/artifact/%!S",zNew))[%S(zNew)]</a>.
432 }
433 if( diffFlags ){
434 append_diff(zOld, zNew, diffFlags, pRe);
435 }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
436 @ &nbsp;&nbsp;
437 @ %z(href("%R/fdiff?v1=%!S&v2=%!S",zOld,zNew))[diff]</a>
438 }
439 }
@@ -450,11 +446,11 @@
450
451 /*
452 ** Construct an appropriate diffFlag for text_diff() based on query
453 ** parameters and the to boolean arguments.
454 */
455 u64 construct_diff_flags(int diffType){
456 u64 diffFlags = 0; /* Zero means do not show any diff */
457 if( diffType>0 ){
458 int x;
459 if( diffType==2 ){
460 diffFlags = DIFF_SIDEBYSIDE;
@@ -474,12 +470,16 @@
474 diffFlags += x;
475
476 /* The "noopt" parameter disables diff optimization */
477 if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
478 diffFlags |= DIFF_STRIP_EOLCR;
 
 
 
 
 
479 }
480 return diffFlags;
481 }
482
483 /*
484 ** WEBPAGE: ci_tags
485 ** URL: /ci_tags?name=ARTIFACTID
@@ -616,20 +616,20 @@
616 void ci_page(void){
617 Stmt q1, q2, q3;
618 int rid;
619 int isLeaf;
620 int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
621 u64 diffFlags; /* Flag parameter for text_diff() */
622 const char *zName; /* Name of the check-in to be displayed */
623 const char *zUuid; /* Hash of zName, found via blob.uuid */
624 const char *zParent; /* Hash of the parent check-in (if any) */
625 const char *zRe; /* regex parameter */
626 ReCompiled *pRe = 0; /* regex */
627 const char *zW; /* URL param for ignoring whitespace */
628 const char *zPage = "vinfo"; /* Page that shows diffs */
629 const char *zPageHide = "ci"; /* Page that hides diffs */
630 const char *zBrName; /* Branch name */
 
631
632 login_check_credentials();
633 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
634 style_set_current_feature("vinfo");
635 zName = P("name");
@@ -880,12 +880,13 @@
880 render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
881 @ <div class="section">Context</div>
882 render_checkin_context(rid, 0, 0, 0);
883 @ <div class="section">Changes</div>
884 @ <div class="sectionmenu">
885 diffFlags = construct_diff_flags(diffType);
886 zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
 
887 if( diffType!=0 ){
888 @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
889 @ Hide&nbsp;Diffs</a>
890 }
891 if( diffType!=1 ){
@@ -935,14 +936,14 @@
935 int mperm = db_column_int(&q3, 1);
936 const char *zOld = db_column_text(&q3,2);
937 const char *zNew = db_column_text(&q3,3);
938 const char *zOldName = db_column_text(&q3, 4);
939 append_file_change_line(zUuid, zName, zOld, zNew, zOldName,
940 diffFlags,pRe,mperm);
941 }
942 db_finalize(&q3);
943 append_diff_javascript(diffType==2);
944 builtin_fossil_js_bundle_or("info-diff",NULL);
945 style_finish_page();
946 }
947
948 /*
@@ -1169,20 +1170,20 @@
1169 ** Show all differences between two check-ins.
1170 */
1171 void vdiff_page(void){
1172 int ridFrom, ridTo;
1173 int diffType = 0; /* 0: none, 1: unified, 2: side-by-side */
1174 u64 diffFlags = 0;
1175 Manifest *pFrom, *pTo;
1176 ManifestFile *pFileFrom, *pFileTo;
1177 const char *zBranch;
1178 const char *zFrom;
1179 const char *zTo;
1180 const char *zRe;
1181 const char *zGlob;
1182 char *zMergeOrigin = 0;
1183 ReCompiled *pRe = 0;
 
1184 int graphFlags = 0;
1185 Blob qp;
1186 int bInvert = PB("inv");
1187
1188 login_check_credentials();
@@ -1231,12 +1232,12 @@
1231 }
1232 if( PB("nc") ){
1233 graphFlags |= TIMELINE_NOCOLOR;
1234 blob_appendf(&qp, "&nc");
1235 }
1236 diffFlags = construct_diff_flags(diffType);
1237 if( diffFlags & DIFF_IGNORE_ALLWS ){
1238 blob_appendf(&qp, "&w");
1239 }
1240 style_set_current_feature("vdiff");
1241 if( zBranch==0 ){
1242 style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
@@ -1255,11 +1256,11 @@
1255 }
1256 if( zGlob ){
1257 style_submenu_element("Clear glob", "%R/vdiff?diff=%d&%b", diffType, &qp);
1258 }else{
1259 style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo,
1260 (diffFlags & DIFF_IGNORE_ALLWS)?"&w":"");
1261 }
1262 if( diffType!=0 ){
1263 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1264 }
1265 if( zBranch ){
@@ -1303,10 +1304,11 @@
1303
1304 manifest_file_rewind(pFrom);
1305 pFileFrom = manifest_file_next(pFrom, 0);
1306 manifest_file_rewind(pTo);
1307 pFileTo = manifest_file_next(pTo, 0);
 
1308 while( pFileFrom || pFileTo ){
1309 int cmp;
1310 if( pFileFrom==0 ){
1311 cmp = +1;
1312 }else if( pFileTo==0 ){
@@ -1315,17 +1317,17 @@
1315 cmp = fossil_strcmp(pFileFrom->zName, pFileTo->zName);
1316 }
1317 if( cmp<0 ){
1318 if( !zGlob || sqlite3_strglob(zGlob, pFileFrom->zName)==0 ){
1319 append_file_change_line(zFrom, pFileFrom->zName,
1320 pFileFrom->zUuid, 0, 0, diffFlags, pRe, 0);
1321 }
1322 pFileFrom = manifest_file_next(pFrom, 0);
1323 }else if( cmp>0 ){
1324 if( !zGlob || sqlite3_strglob(zGlob, pFileTo->zName)==0 ){
1325 append_file_change_line(zTo, pFileTo->zName,
1326 0, pFileTo->zUuid, 0, diffFlags, pRe,
1327 manifest_file_mperm(pFileTo));
1328 }
1329 pFileTo = manifest_file_next(pTo, 0);
1330 }else if( fossil_strcmp(pFileFrom->zUuid, pFileTo->zUuid)==0 ){
1331 pFileFrom = manifest_file_next(pFrom, 0);
@@ -1333,11 +1335,11 @@
1333 }else{
1334 if(!zGlob || (sqlite3_strglob(zGlob, pFileFrom->zName)==0
1335 || sqlite3_strglob(zGlob, pFileTo->zName)==0) ){
1336 append_file_change_line(zFrom, pFileFrom->zName,
1337 pFileFrom->zUuid,
1338 pFileTo->zUuid, 0, diffFlags, pRe,
1339 manifest_file_mperm(pFileTo));
1340 }
1341 pFileFrom = manifest_file_next(pFrom, 0);
1342 pFileTo = manifest_file_next(pTo, 0);
1343 }
@@ -1724,10 +1726,11 @@
1724 const char *zRe;
1725 ReCompiled *pRe = 0;
1726 u64 diffFlags;
1727 u32 objdescFlags = 0;
1728 int verbose = PB("verbose");
 
1729
1730 login_check_credentials();
1731 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1732 diffType = preferred_diff_type();
1733 if( P("from") && P("to") ){
@@ -1777,19 +1780,21 @@
1777 cgi_set_content_type("text/plain");
1778 diffFlags = 4;
1779 content_get(v1, &c1);
1780 content_get(v2, &c2);
1781 diff_config_init(&DCfg, diffFlags);
1782 text_diff(&c1, &c2, pOut, pRe, &DCfg);
 
1783 blob_reset(&c1);
1784 blob_reset(&c2);
1785 return;
1786 }
1787
1788 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1789 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1790 diffFlags = construct_diff_flags(diffType) | DIFF_HTML;
 
1791
1792 style_set_current_feature("fdiff");
1793 style_header("Diff");
1794 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1795 if( diffType==2 ){
@@ -1815,13 +1820,14 @@
1815 object_description(v2, objdescFlags,0, 0);
1816 }
1817 if( pRe ){
1818 @ <b>Only differences that match regular expression "%h(zRe)"
1819 @ are shown.</b>
 
1820 }
1821 @ <hr />
1822 append_diff(zV1, zV2, diffFlags, pRe);
1823 append_diff_javascript(diffType);
1824 style_finish_page();
1825 }
1826
1827 /*
1828
--- src/info.c
+++ src/info.c
@@ -330,17 +330,15 @@
330 ** Append the difference between artifacts to the output
331 */
332 static void append_diff(
333 const char *zFrom, /* Diff from this artifact */
334 const char *zTo, /* ... to this artifact */
335 DiffConfig *pCfg /* The diff configuration */
 
336 ){
337 int fromid;
338 int toid;
339 Blob from, to;
 
340 if( zFrom ){
341 fromid = uuid_to_rid(zFrom, 0);
342 content_get(fromid, &from);
343 }else{
344 blob_zero(&from);
@@ -349,17 +347,16 @@
347 toid = uuid_to_rid(zTo, 0);
348 content_get(toid, &to);
349 }else{
350 blob_zero(&to);
351 }
352 if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
353 pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
354 }else{
355 pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG;
356 }
357 text_diff(&from, &to, cgi_output_blob(), pCfg);
 
358 blob_reset(&from);
359 blob_reset(&to);
360 }
361
362 /*
@@ -370,12 +367,11 @@
367 const char *zCkin, /* The checkin on which the change occurs */
368 const char *zName, /* Name of the file that has changed */
369 const char *zOld, /* blob.uuid before change. NULL for added files */
370 const char *zNew, /* blob.uuid after change. NULL for deletes */
371 const char *zOldName, /* Prior name. NULL if no name change. */
372 DiffConfig *pCfg, /* Flags for text_diff() or NULL to omit all */
 
373 int mperm /* executable or symlink permission for zNew */
374 ){
375 @ <p>
376 if( !g.perm.Hyperlink ){
377 if( zNew==0 ){
@@ -393,12 +389,12 @@
389 @ %h(zName) became a regular file.
390 }
391 }else{
392 @ Changes to %h(zName).
393 }
394 if( pCfg ){
395 append_diff(zOld, zNew, pCfg);
396 }
397 }else{
398 if( zOld && zNew ){
399 if( fossil_strcmp(zOld, zNew)!=0 ){
400 @ Modified %z(href("%R/finfo?name=%T&m=%!S&ci=%!S",zName,zNew,zCkin))\
@@ -428,12 +424,12 @@
424 @ %h(zName)</a> version %z(href("%R/artifact/%!S",zOld))[%S(zOld)]</a>.
425 }else{
426 @ Added %z(href("%R/finfo?name=%T&m=%!S&ci=%!S",zName,zNew,zCkin))\
427 @ %h(zName)</a> version %z(href("%R/artifact/%!S",zNew))[%S(zNew)]</a>.
428 }
429 if( pCfg ){
430 append_diff(zOld, zNew, pCfg);
431 }else if( zOld && zNew && fossil_strcmp(zOld,zNew)!=0 ){
432 @ &nbsp;&nbsp;
433 @ %z(href("%R/fdiff?v1=%!S&v2=%!S",zOld,zNew))[diff]</a>
434 }
435 }
@@ -450,11 +446,11 @@
446
447 /*
448 ** Construct an appropriate diffFlag for text_diff() based on query
449 ** parameters and the to boolean arguments.
450 */
451 DiffConfig *construct_diff_flags(int diffType, DiffConfig *pCfg){
452 u64 diffFlags = 0; /* Zero means do not show any diff */
453 if( diffType>0 ){
454 int x;
455 if( diffType==2 ){
456 diffFlags = DIFF_SIDEBYSIDE;
@@ -474,12 +470,16 @@
470 diffFlags += x;
471
472 /* The "noopt" parameter disables diff optimization */
473 if( PD("noopt",0)!=0 ) diffFlags |= DIFF_NOOPT;
474 diffFlags |= DIFF_STRIP_EOLCR;
475 diff_config_init(pCfg, diffFlags);
476 return pCfg;
477 }else{
478 diff_config_init(pCfg, 0);
479 return 0;
480 }
 
481 }
482
483 /*
484 ** WEBPAGE: ci_tags
485 ** URL: /ci_tags?name=ARTIFACTID
@@ -616,20 +616,20 @@
616 void ci_page(void){
617 Stmt q1, q2, q3;
618 int rid;
619 int isLeaf;
620 int diffType; /* 0: no diff, 1: unified, 2: side-by-side */
 
621 const char *zName; /* Name of the check-in to be displayed */
622 const char *zUuid; /* Hash of zName, found via blob.uuid */
623 const char *zParent; /* Hash of the parent check-in (if any) */
624 const char *zRe; /* regex parameter */
625 ReCompiled *pRe = 0; /* regex */
626 const char *zW; /* URL param for ignoring whitespace */
627 const char *zPage = "vinfo"; /* Page that shows diffs */
628 const char *zPageHide = "ci"; /* Page that hides diffs */
629 const char *zBrName; /* Branch name */
630 DiffConfig DCfg,*pCfg; /* Type of diff */
631
632 login_check_credentials();
633 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
634 style_set_current_feature("vinfo");
635 zName = P("name");
@@ -880,12 +880,13 @@
880 render_backlink_graph(zUuid, "<div class=\"section\">References</div>\n");
881 @ <div class="section">Context</div>
882 render_checkin_context(rid, 0, 0, 0);
883 @ <div class="section">Changes</div>
884 @ <div class="sectionmenu">
885 pCfg = construct_diff_flags(diffType, &DCfg);
886 DCfg.pRe = pRe;
887 zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":"";
888 if( diffType!=0 ){
889 @ %z(chref("button","%R/%s/%T?diff=0",zPageHide,zName))\
890 @ Hide&nbsp;Diffs</a>
891 }
892 if( diffType!=1 ){
@@ -935,14 +936,14 @@
936 int mperm = db_column_int(&q3, 1);
937 const char *zOld = db_column_text(&q3,2);
938 const char *zNew = db_column_text(&q3,3);
939 const char *zOldName = db_column_text(&q3, 4);
940 append_file_change_line(zUuid, zName, zOld, zNew, zOldName,
941 pCfg,mperm);
942 }
943 db_finalize(&q3);
944 append_diff_javascript(diffType);
945 builtin_fossil_js_bundle_or("info-diff",NULL);
946 style_finish_page();
947 }
948
949 /*
@@ -1169,20 +1170,20 @@
1170 ** Show all differences between two check-ins.
1171 */
1172 void vdiff_page(void){
1173 int ridFrom, ridTo;
1174 int diffType = 0; /* 0: none, 1: unified, 2: side-by-side */
 
1175 Manifest *pFrom, *pTo;
1176 ManifestFile *pFileFrom, *pFileTo;
1177 const char *zBranch;
1178 const char *zFrom;
1179 const char *zTo;
1180 const char *zRe;
1181 const char *zGlob;
1182 char *zMergeOrigin = 0;
1183 ReCompiled *pRe = 0;
1184 DiffConfig DCfg, *pCfg = 0;
1185 int graphFlags = 0;
1186 Blob qp;
1187 int bInvert = PB("inv");
1188
1189 login_check_credentials();
@@ -1231,12 +1232,12 @@
1232 }
1233 if( PB("nc") ){
1234 graphFlags |= TIMELINE_NOCOLOR;
1235 blob_appendf(&qp, "&nc");
1236 }
1237 pCfg = construct_diff_flags(diffType, &DCfg);
1238 if( DCfg.diffFlags & DIFF_IGNORE_ALLWS ){
1239 blob_appendf(&qp, "&w");
1240 }
1241 style_set_current_feature("vdiff");
1242 if( zBranch==0 ){
1243 style_submenu_element("Path", "%R/timeline?me=%T&you=%T", zFrom, zTo);
@@ -1255,11 +1256,11 @@
1256 }
1257 if( zGlob ){
1258 style_submenu_element("Clear glob", "%R/vdiff?diff=%d&%b", diffType, &qp);
1259 }else{
1260 style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo,
1261 (DCfg.diffFlags & DIFF_IGNORE_ALLWS)?"&w":"");
1262 }
1263 if( diffType!=0 ){
1264 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1265 }
1266 if( zBranch ){
@@ -1303,10 +1304,11 @@
1304
1305 manifest_file_rewind(pFrom);
1306 pFileFrom = manifest_file_next(pFrom, 0);
1307 manifest_file_rewind(pTo);
1308 pFileTo = manifest_file_next(pTo, 0);
1309 DCfg.pRe = pRe;
1310 while( pFileFrom || pFileTo ){
1311 int cmp;
1312 if( pFileFrom==0 ){
1313 cmp = +1;
1314 }else if( pFileTo==0 ){
@@ -1315,17 +1317,17 @@
1317 cmp = fossil_strcmp(pFileFrom->zName, pFileTo->zName);
1318 }
1319 if( cmp<0 ){
1320 if( !zGlob || sqlite3_strglob(zGlob, pFileFrom->zName)==0 ){
1321 append_file_change_line(zFrom, pFileFrom->zName,
1322 pFileFrom->zUuid, 0, 0, pCfg, 0);
1323 }
1324 pFileFrom = manifest_file_next(pFrom, 0);
1325 }else if( cmp>0 ){
1326 if( !zGlob || sqlite3_strglob(zGlob, pFileTo->zName)==0 ){
1327 append_file_change_line(zTo, pFileTo->zName,
1328 0, pFileTo->zUuid, 0, pCfg,
1329 manifest_file_mperm(pFileTo));
1330 }
1331 pFileTo = manifest_file_next(pTo, 0);
1332 }else if( fossil_strcmp(pFileFrom->zUuid, pFileTo->zUuid)==0 ){
1333 pFileFrom = manifest_file_next(pFrom, 0);
@@ -1333,11 +1335,11 @@
1335 }else{
1336 if(!zGlob || (sqlite3_strglob(zGlob, pFileFrom->zName)==0
1337 || sqlite3_strglob(zGlob, pFileTo->zName)==0) ){
1338 append_file_change_line(zFrom, pFileFrom->zName,
1339 pFileFrom->zUuid,
1340 pFileTo->zUuid, 0, pCfg,
1341 manifest_file_mperm(pFileTo));
1342 }
1343 pFileFrom = manifest_file_next(pFrom, 0);
1344 pFileTo = manifest_file_next(pTo, 0);
1345 }
@@ -1724,10 +1726,11 @@
1726 const char *zRe;
1727 ReCompiled *pRe = 0;
1728 u64 diffFlags;
1729 u32 objdescFlags = 0;
1730 int verbose = PB("verbose");
1731 DiffConfig DCfg;
1732
1733 login_check_credentials();
1734 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1735 diffType = preferred_diff_type();
1736 if( P("from") && P("to") ){
@@ -1777,19 +1780,21 @@
1780 cgi_set_content_type("text/plain");
1781 diffFlags = 4;
1782 content_get(v1, &c1);
1783 content_get(v2, &c2);
1784 diff_config_init(&DCfg, diffFlags);
1785 DCfg.pRe = pRe;
1786 text_diff(&c1, &c2, pOut, &DCfg);
1787 blob_reset(&c1);
1788 blob_reset(&c2);
1789 return;
1790 }
1791
1792 zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
1793 zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
1794 construct_diff_flags(diffType, &DCfg);
1795 DCfg.diffFlags |= DIFF_HTML;
1796
1797 style_set_current_feature("fdiff");
1798 style_header("Diff");
1799 style_submenu_checkbox("w", "Ignore Whitespace", 0, 0);
1800 if( diffType==2 ){
@@ -1815,13 +1820,14 @@
1820 object_description(v2, objdescFlags,0, 0);
1821 }
1822 if( pRe ){
1823 @ <b>Only differences that match regular expression "%h(zRe)"
1824 @ are shown.</b>
1825 DCfg.pRe = pRe;
1826 }
1827 @ <hr />
1828 append_diff(zV1, zV2, &DCfg);
1829 append_diff_javascript(diffType);
1830 style_finish_page();
1831 }
1832
1833 /*
1834
+3 -1
--- src/json_diff.c
+++ src/json_diff.c
@@ -38,10 +38,11 @@
3838
int nContext, char fSbs,
3939
char fHtml){
4040
int fromid;
4141
int toid;
4242
int outLen;
43
+ DiffConfig DCfg;
4344
Blob from = empty_blob, to = empty_blob, out = empty_blob;
4445
cson_value * rc = NULL;
4546
int flags = (DIFF_CONTEXT_MASK & nContext)
4647
| (fSbs ? DIFF_SIDEBYSIDE : 0)
4748
| (fHtml ? DIFF_HTML : 0);
@@ -58,11 +59,12 @@
5859
return NULL;
5960
}
6061
content_get(fromid, &from);
6162
content_get(toid, &to);
6263
blob_zero(&out);
63
- text_diff(&from, &to, &out, 0, flags);
64
+ diff_config_init(&DCfg, flags);
65
+ text_diff(&from, &to, &out, &DCfg);
6466
blob_reset(&from);
6567
blob_reset(&to);
6668
outLen = blob_size(&out);
6769
if(outLen>=0){
6870
rc = cson_value_new_string(blob_buffer(&out),
6971
--- src/json_diff.c
+++ src/json_diff.c
@@ -38,10 +38,11 @@
38 int nContext, char fSbs,
39 char fHtml){
40 int fromid;
41 int toid;
42 int outLen;
 
43 Blob from = empty_blob, to = empty_blob, out = empty_blob;
44 cson_value * rc = NULL;
45 int flags = (DIFF_CONTEXT_MASK & nContext)
46 | (fSbs ? DIFF_SIDEBYSIDE : 0)
47 | (fHtml ? DIFF_HTML : 0);
@@ -58,11 +59,12 @@
58 return NULL;
59 }
60 content_get(fromid, &from);
61 content_get(toid, &to);
62 blob_zero(&out);
63 text_diff(&from, &to, &out, 0, flags);
 
64 blob_reset(&from);
65 blob_reset(&to);
66 outLen = blob_size(&out);
67 if(outLen>=0){
68 rc = cson_value_new_string(blob_buffer(&out),
69
--- src/json_diff.c
+++ src/json_diff.c
@@ -38,10 +38,11 @@
38 int nContext, char fSbs,
39 char fHtml){
40 int fromid;
41 int toid;
42 int outLen;
43 DiffConfig DCfg;
44 Blob from = empty_blob, to = empty_blob, out = empty_blob;
45 cson_value * rc = NULL;
46 int flags = (DIFF_CONTEXT_MASK & nContext)
47 | (fSbs ? DIFF_SIDEBYSIDE : 0)
48 | (fHtml ? DIFF_HTML : 0);
@@ -58,11 +59,12 @@
59 return NULL;
60 }
61 content_get(fromid, &from);
62 content_get(toid, &to);
63 blob_zero(&out);
64 diff_config_init(&DCfg, flags);
65 text_diff(&from, &to, &out, &DCfg);
66 blob_reset(&from);
67 blob_reset(&to);
68 outLen = blob_size(&out);
69 if(outLen>=0){
70 rc = cson_value_new_string(blob_buffer(&out),
71
+3 -3
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -519,11 +519,11 @@
519519
int argPos = g.json.dispatchDepth;
520520
int r1 = 0, r2 = 0;
521521
Manifest * pW1 = NULL, *pW2 = NULL;
522522
Blob w1 = empty_blob, w2 = empty_blob, d = empty_blob;
523523
char const * zErrTag = NULL;
524
- u64 diffFlags;
524
+ DiffConfig DCfg;
525525
char * zUuid = NULL;
526526
if( !g.perm.Hyperlink ){
527527
json_set_err(FSL_JSON_E_DENIED,
528528
"Requires 'h' permissions.");
529529
return NULL;
@@ -567,12 +567,12 @@
567567
568568
blob_init(&w1, pW1->zWiki, -1);
569569
blob_zero(&w2);
570570
blob_init(&w2, pW2->zWiki, -1);
571571
blob_zero(&d);
572
- diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR;
573
- text_diff(&w1, &w2, &d, 0, diffFlags);
572
+ diff_config_init(&DCfg, DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR);
573
+ text_diff(&w1, &w2, &d, &DCfg);
574574
blob_reset(&w1);
575575
blob_reset(&w2);
576576
577577
pay = cson_new_object();
578578
579579
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -519,11 +519,11 @@
519 int argPos = g.json.dispatchDepth;
520 int r1 = 0, r2 = 0;
521 Manifest * pW1 = NULL, *pW2 = NULL;
522 Blob w1 = empty_blob, w2 = empty_blob, d = empty_blob;
523 char const * zErrTag = NULL;
524 u64 diffFlags;
525 char * zUuid = NULL;
526 if( !g.perm.Hyperlink ){
527 json_set_err(FSL_JSON_E_DENIED,
528 "Requires 'h' permissions.");
529 return NULL;
@@ -567,12 +567,12 @@
567
568 blob_init(&w1, pW1->zWiki, -1);
569 blob_zero(&w2);
570 blob_init(&w2, pW2->zWiki, -1);
571 blob_zero(&d);
572 diffFlags = DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR;
573 text_diff(&w1, &w2, &d, 0, diffFlags);
574 blob_reset(&w1);
575 blob_reset(&w2);
576
577 pay = cson_new_object();
578
579
--- src/json_wiki.c
+++ src/json_wiki.c
@@ -519,11 +519,11 @@
519 int argPos = g.json.dispatchDepth;
520 int r1 = 0, r2 = 0;
521 Manifest * pW1 = NULL, *pW2 = NULL;
522 Blob w1 = empty_blob, w2 = empty_blob, d = empty_blob;
523 char const * zErrTag = NULL;
524 DiffConfig DCfg;
525 char * zUuid = NULL;
526 if( !g.perm.Hyperlink ){
527 json_set_err(FSL_JSON_E_DENIED,
528 "Requires 'h' permissions.");
529 return NULL;
@@ -567,12 +567,12 @@
567
568 blob_init(&w1, pW1->zWiki, -1);
569 blob_zero(&w2);
570 blob_init(&w2, pW2->zWiki, -1);
571 blob_zero(&d);
572 diff_config_init(&DCfg, DIFF_IGNORE_EOLWS | DIFF_STRIP_EOLCR);
573 text_diff(&w1, &w2, &d, &DCfg);
574 blob_reset(&w1);
575 blob_reset(&w2);
576
577 pay = cson_new_object();
578
579
+4 -2
--- src/merge3.c
+++ src/merge3.c
@@ -196,10 +196,11 @@
196196
int i1, i2; /* Index into aC1[] and aC2[] */
197197
int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
198198
int limit1, limit2; /* Sizes of aC1[] and aC2[] */
199199
int nConflict = 0; /* Number of merge conflicts seen so far */
200200
int useCrLf = 0;
201
+ DiffConfig DCfg;
201202
202203
blob_zero(pOut); /* Merge results stored in pOut */
203204
204205
/* If both pV1 and pV2 start with a UTF-8 byte-order-mark (BOM),
205206
** keep it in the output. This should be secure enough not to cause
@@ -224,12 +225,13 @@
224225
** is the number of lines of text to copy directly from the pivot,
225226
** the second integer is the number of lines of text to omit from the
226227
** pivot, and the third integer is the number of lines of text that are
227228
** inserted. The edit array ends with a triple of 0,0,0.
228229
*/
229
- aC1 = text_diff(pPivot, pV1, 0, 0, 0);
230
- aC2 = text_diff(pPivot, pV2, 0, 0, 0);
230
+ diff_config_init(&DCfg, 0);
231
+ aC1 = text_diff(pPivot, pV1, 0, &DCfg);
232
+ aC2 = text_diff(pPivot, pV2, 0, &DCfg);
231233
if( aC1==0 || aC2==0 ){
232234
free(aC1);
233235
free(aC2);
234236
return -1;
235237
}
236238
--- src/merge3.c
+++ src/merge3.c
@@ -196,10 +196,11 @@
196 int i1, i2; /* Index into aC1[] and aC2[] */
197 int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
198 int limit1, limit2; /* Sizes of aC1[] and aC2[] */
199 int nConflict = 0; /* Number of merge conflicts seen so far */
200 int useCrLf = 0;
 
201
202 blob_zero(pOut); /* Merge results stored in pOut */
203
204 /* If both pV1 and pV2 start with a UTF-8 byte-order-mark (BOM),
205 ** keep it in the output. This should be secure enough not to cause
@@ -224,12 +225,13 @@
224 ** is the number of lines of text to copy directly from the pivot,
225 ** the second integer is the number of lines of text to omit from the
226 ** pivot, and the third integer is the number of lines of text that are
227 ** inserted. The edit array ends with a triple of 0,0,0.
228 */
229 aC1 = text_diff(pPivot, pV1, 0, 0, 0);
230 aC2 = text_diff(pPivot, pV2, 0, 0, 0);
 
231 if( aC1==0 || aC2==0 ){
232 free(aC1);
233 free(aC2);
234 return -1;
235 }
236
--- src/merge3.c
+++ src/merge3.c
@@ -196,10 +196,11 @@
196 int i1, i2; /* Index into aC1[] and aC2[] */
197 int nCpy, nDel, nIns; /* Number of lines to copy, delete, or insert */
198 int limit1, limit2; /* Sizes of aC1[] and aC2[] */
199 int nConflict = 0; /* Number of merge conflicts seen so far */
200 int useCrLf = 0;
201 DiffConfig DCfg;
202
203 blob_zero(pOut); /* Merge results stored in pOut */
204
205 /* If both pV1 and pV2 start with a UTF-8 byte-order-mark (BOM),
206 ** keep it in the output. This should be secure enough not to cause
@@ -224,12 +225,13 @@
225 ** is the number of lines of text to copy directly from the pivot,
226 ** the second integer is the number of lines of text to omit from the
227 ** pivot, and the third integer is the number of lines of text that are
228 ** inserted. The edit array ends with a triple of 0,0,0.
229 */
230 diff_config_init(&DCfg, 0);
231 aC1 = text_diff(pPivot, pV1, 0, &DCfg);
232 aC2 = text_diff(pPivot, pV2, 0, &DCfg);
233 if( aC1==0 || aC2==0 ){
234 free(aC1);
235 free(aC2);
236 return -1;
237 }
238
+7 -6
--- src/skins.c
+++ src/skins.c
@@ -867,24 +867,25 @@
867867
@ Baseline: \
868868
skin_emit_skin_selector("basis", zBasis, zDraft);
869869
@ <input type="submit" name="diff" value="Unified Diff" />
870870
@ <input type="submit" name="sbsdiff" value="Side-by-Side Diff" />
871871
if( P("diff")!=0 || P("sbsdiff")!=0 ){
872
- u64 diffFlags = construct_diff_flags(1) | DIFF_STRIP_EOLCR;
873872
Blob from, to, out;
874873
DiffConfig DCfg;
875
- if( P("sbsdiff")!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
874
+ construct_diff_flags(1, &DCfg);
875
+ DCfg.diffFlags |= DIFF_STRIP_EOLCR;
876
+ if( P("sbsdiff")!=0 ) DCfg.diffFlags |= DIFF_SIDEBYSIDE;
876877
blob_init(&to, zContent, -1);
877878
blob_init(&from, skin_file_content(zBasis, zFile), -1);
878879
blob_zero(&out);
879
- diff_config_init(&DCfg, diffFlags | DIFF_HTML | DIFF_NOTTOOBIG);
880
- if( diffFlags & DIFF_SIDEBYSIDE ){
881
- text_diff(&from, &to, &out, 0, &DCfg );
880
+ DCfg.diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
881
+ if( DCfg.diffFlags & DIFF_SIDEBYSIDE ){
882
+ text_diff(&from, &to, &out, &DCfg);
882883
@ %s(blob_str(&out))
883884
}else{
884885
DCfg.diffFlags |= DIFF_LINENO;
885
- text_diff(&from, &to, &out, 0, &DCfg);
886
+ text_diff(&from, &to, &out, &DCfg);
886887
@ <pre class="udiff">
887888
@ %s(blob_str(&out))
888889
@ </pre>
889890
}
890891
blob_reset(&from);
891892
--- src/skins.c
+++ src/skins.c
@@ -867,24 +867,25 @@
867 @ Baseline: \
868 skin_emit_skin_selector("basis", zBasis, zDraft);
869 @ <input type="submit" name="diff" value="Unified Diff" />
870 @ <input type="submit" name="sbsdiff" value="Side-by-Side Diff" />
871 if( P("diff")!=0 || P("sbsdiff")!=0 ){
872 u64 diffFlags = construct_diff_flags(1) | DIFF_STRIP_EOLCR;
873 Blob from, to, out;
874 DiffConfig DCfg;
875 if( P("sbsdiff")!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
 
 
876 blob_init(&to, zContent, -1);
877 blob_init(&from, skin_file_content(zBasis, zFile), -1);
878 blob_zero(&out);
879 diff_config_init(&DCfg, diffFlags | DIFF_HTML | DIFF_NOTTOOBIG);
880 if( diffFlags & DIFF_SIDEBYSIDE ){
881 text_diff(&from, &to, &out, 0, &DCfg );
882 @ %s(blob_str(&out))
883 }else{
884 DCfg.diffFlags |= DIFF_LINENO;
885 text_diff(&from, &to, &out, 0, &DCfg);
886 @ <pre class="udiff">
887 @ %s(blob_str(&out))
888 @ </pre>
889 }
890 blob_reset(&from);
891
--- src/skins.c
+++ src/skins.c
@@ -867,24 +867,25 @@
867 @ Baseline: \
868 skin_emit_skin_selector("basis", zBasis, zDraft);
869 @ <input type="submit" name="diff" value="Unified Diff" />
870 @ <input type="submit" name="sbsdiff" value="Side-by-Side Diff" />
871 if( P("diff")!=0 || P("sbsdiff")!=0 ){
 
872 Blob from, to, out;
873 DiffConfig DCfg;
874 construct_diff_flags(1, &DCfg);
875 DCfg.diffFlags |= DIFF_STRIP_EOLCR;
876 if( P("sbsdiff")!=0 ) DCfg.diffFlags |= DIFF_SIDEBYSIDE;
877 blob_init(&to, zContent, -1);
878 blob_init(&from, skin_file_content(zBasis, zFile), -1);
879 blob_zero(&out);
880 DCfg.diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG;
881 if( DCfg.diffFlags & DIFF_SIDEBYSIDE ){
882 text_diff(&from, &to, &out, &DCfg);
883 @ %s(blob_str(&out))
884 }else{
885 DCfg.diffFlags |= DIFF_LINENO;
886 text_diff(&from, &to, &out, &DCfg);
887 @ <pre class="udiff">
888 @ %s(blob_str(&out))
889 @ </pre>
890 }
891 blob_reset(&from);
892
+3 -4
--- src/wiki.c
+++ src/wiki.c
@@ -1815,11 +1815,10 @@
18151815
const char *zId;
18161816
const char *zPid;
18171817
Manifest *pW1, *pW2 = 0;
18181818
int rid1, rid2, nextRid;
18191819
Blob w1, w2, d;
1820
- u64 diffFlags;
18211820
DiffConfig DCfg;
18221821
18231822
login_check_credentials();
18241823
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
18251824
zId = P("id");
@@ -1859,13 +1858,13 @@
18591858
style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
18601859
}
18611860
style_set_current_feature("wiki");
18621861
style_header("Changes To %s", pW1->zWikiTitle);
18631862
blob_zero(&d);
1864
- diffFlags = construct_diff_flags(1);
1865
- diff_config_init(&DCfg, diffFlags | DIFF_HTML | DIFF_LINENO);
1866
- text_diff(&w2, &w1, &d, 0, &DCfg);
1863
+ construct_diff_flags(1, &DCfg);
1864
+ DCfg.diffFlags |= DIFF_HTML | DIFF_LINENO;
1865
+ text_diff(&w2, &w1, &d, &DCfg);
18671866
@ <pre class="udiff">
18681867
@ %s(blob_str(&d))
18691868
@ <pre>
18701869
manifest_destroy(pW1);
18711870
manifest_destroy(pW2);
18721871
--- src/wiki.c
+++ src/wiki.c
@@ -1815,11 +1815,10 @@
1815 const char *zId;
1816 const char *zPid;
1817 Manifest *pW1, *pW2 = 0;
1818 int rid1, rid2, nextRid;
1819 Blob w1, w2, d;
1820 u64 diffFlags;
1821 DiffConfig DCfg;
1822
1823 login_check_credentials();
1824 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1825 zId = P("id");
@@ -1859,13 +1858,13 @@
1859 style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
1860 }
1861 style_set_current_feature("wiki");
1862 style_header("Changes To %s", pW1->zWikiTitle);
1863 blob_zero(&d);
1864 diffFlags = construct_diff_flags(1);
1865 diff_config_init(&DCfg, diffFlags | DIFF_HTML | DIFF_LINENO);
1866 text_diff(&w2, &w1, &d, 0, &DCfg);
1867 @ <pre class="udiff">
1868 @ %s(blob_str(&d))
1869 @ <pre>
1870 manifest_destroy(pW1);
1871 manifest_destroy(pW2);
1872
--- src/wiki.c
+++ src/wiki.c
@@ -1815,11 +1815,10 @@
1815 const char *zId;
1816 const char *zPid;
1817 Manifest *pW1, *pW2 = 0;
1818 int rid1, rid2, nextRid;
1819 Blob w1, w2, d;
 
1820 DiffConfig DCfg;
1821
1822 login_check_credentials();
1823 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
1824 zId = P("id");
@@ -1859,13 +1858,13 @@
1858 style_submenu_element("Next", "%R/wdiff?rid=%d", nextRid);
1859 }
1860 style_set_current_feature("wiki");
1861 style_header("Changes To %s", pW1->zWikiTitle);
1862 blob_zero(&d);
1863 construct_diff_flags(1, &DCfg);
1864 DCfg.diffFlags |= DIFF_HTML | DIFF_LINENO;
1865 text_diff(&w2, &w1, &d, &DCfg);
1866 @ <pre class="udiff">
1867 @ %s(blob_str(&d))
1868 @ <pre>
1869 manifest_destroy(pW1);
1870 manifest_destroy(pW2);
1871

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button