Fossil SCM

Futher integration of DiffConfig up and down the diff stack.

drh 2021-09-06 19:24 diff-config
Commit 7c1498aeffdd43a27ad61a1f4bf1eaa38e10836d36c31f362837ed58246e6d54
4 files changed +18 -18 +31 -27 +4 -4 +6 -6
+18 -18
--- src/diff.c
+++ src/diff.c
@@ -2745,23 +2745,23 @@
27452745
** Initialize the DiffConfig object using command-line options.
27462746
**
27472747
** Process diff-related command-line options and return an appropriate
27482748
** "diffFlags" integer.
27492749
**
2750
-** --brief Show filenames only DIFF_BRIEF
2751
-** -c|--context N N lines of context. DIFF_CONTEXT_MASK
2752
-** --html Format for HTML DIFF_HTML
2753
-** --invert Invert the diff DIFF_INVERT
2754
-** -n|--linenum Show line numbers DIFF_LINENO
2755
-** --noopt Disable optimization DIFF_NOOPT
2756
-** --numstat Show change counts DIFF_NUMSTAT
2757
-** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR
2758
-** --unified Unified diff. ~DIFF_SIDEBYSIDE
2759
-** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
2760
-** -W|--width N N character lines. DIFF_WIDTH_MASK
2761
-** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
2762
-** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
2750
+** --brief Show filenames only DIFF_BRIEF
2751
+** -c|--context N N lines of context. DIFF_CONTEXT_MASK
2752
+** --html Format for HTML DIFF_HTML
2753
+** --invert Invert the diff DIFF_INVERT
2754
+** -n|--linenum Show line numbers DIFF_LINENO
2755
+** --noopt Disable optimization DIFF_NOOPT
2756
+** --numstat Show change counts DIFF_NUMSTAT
2757
+** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR
2758
+** --unified Unified diff. ~DIFF_SIDEBYSIDE
2759
+** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
2760
+** -W|--width N N character lines. DIFF_WIDTH_MASK
2761
+** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
2762
+** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
27632763
*/
27642764
void diff_options(DiffConfig *pCfg, int isGDiff){
27652765
u64 diffFlags = 0;
27662766
const char *z;
27672767
int f;
@@ -2837,18 +2837,18 @@
28372837
** See the "diff" command for a full list of command-line options.
28382838
**
28392839
** This command used to be called "test-diff". The older "test-diff" spelling
28402840
** still works, for compatibility.
28412841
*/
2842
-void test_diff_cmd(void){
2842
+void xdiff_cmd(void){
28432843
Blob a, b, out;
28442844
const char *zRe; /* Regex filter for diff output */
28452845
ReCompiled *pRe = 0; /* Regex filter for diff output */
28462846
DiffConfig DCfg;
28472847
28482848
if( find_option("tk",0,0)!=0 ){
2849
- diff_tk("test-diff", 2);
2849
+ diff_tk("xdiff", 2);
28502850
return;
28512851
}
28522852
find_option("i",0,0);
28532853
find_option("v",0,0);
28542854
zRe = find_option("regexp","e",1);
@@ -2858,17 +2858,17 @@
28582858
}
28592859
diff_options(&DCfg, 0);
28602860
verify_all_options();
28612861
if( g.argc!=4 ) usage("FILE1 FILE2");
28622862
blob_zero(&out);
2863
- diff_begin(DCfg.diffFlags);
2864
- diff_print_filenames(g.argv[2], g.argv[3], DCfg.diffFlags, &out);
2863
+ diff_begin(&DCfg);
2864
+ diff_print_filenames(g.argv[2], g.argv[3], &DCfg, &out);
28652865
blob_read_from_file(&a, g.argv[2], ExtFILE);
28662866
blob_read_from_file(&b, g.argv[3], ExtFILE);
28672867
text_diff(&a, &b, &out, pRe, &DCfg);
28682868
blob_write_to_file(&out, "-");
2869
- diff_end(DCfg.diffFlags, 0);
2869
+ diff_end(&DCfg, 0);
28702870
re_free(pRe);
28712871
}
28722872
28732873
/**************************************************************************
28742874
** The basic difference engine is above. What follows is the annotation
28752875
--- src/diff.c
+++ src/diff.c
@@ -2745,23 +2745,23 @@
2745 ** Initialize the DiffConfig object using command-line options.
2746 **
2747 ** Process diff-related command-line options and return an appropriate
2748 ** "diffFlags" integer.
2749 **
2750 ** --brief Show filenames only DIFF_BRIEF
2751 ** -c|--context N N lines of context. DIFF_CONTEXT_MASK
2752 ** --html Format for HTML DIFF_HTML
2753 ** --invert Invert the diff DIFF_INVERT
2754 ** -n|--linenum Show line numbers DIFF_LINENO
2755 ** --noopt Disable optimization DIFF_NOOPT
2756 ** --numstat Show change counts DIFF_NUMSTAT
2757 ** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR
2758 ** --unified Unified diff. ~DIFF_SIDEBYSIDE
2759 ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
2760 ** -W|--width N N character lines. DIFF_WIDTH_MASK
2761 ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
2762 ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
2763 */
2764 void diff_options(DiffConfig *pCfg, int isGDiff){
2765 u64 diffFlags = 0;
2766 const char *z;
2767 int f;
@@ -2837,18 +2837,18 @@
2837 ** See the "diff" command for a full list of command-line options.
2838 **
2839 ** This command used to be called "test-diff". The older "test-diff" spelling
2840 ** still works, for compatibility.
2841 */
2842 void test_diff_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("test-diff", 2);
2850 return;
2851 }
2852 find_option("i",0,0);
2853 find_option("v",0,0);
2854 zRe = find_option("regexp","e",1);
@@ -2858,17 +2858,17 @@
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.diffFlags);
2864 diff_print_filenames(g.argv[2], g.argv[3], DCfg.diffFlags, &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.diffFlags, 0);
2870 re_free(pRe);
2871 }
2872
2873 /**************************************************************************
2874 ** The basic difference engine is above. What follows is the annotation
2875
--- src/diff.c
+++ src/diff.c
@@ -2745,23 +2745,23 @@
2745 ** Initialize the DiffConfig object using command-line options.
2746 **
2747 ** Process diff-related command-line options and return an appropriate
2748 ** "diffFlags" integer.
2749 **
2750 ** --brief Show filenames only DIFF_BRIEF
2751 ** -c|--context N N lines of context. DIFF_CONTEXT_MASK
2752 ** --html Format for HTML DIFF_HTML
2753 ** --invert Invert the diff DIFF_INVERT
2754 ** -n|--linenum Show line numbers DIFF_LINENO
2755 ** --noopt Disable optimization DIFF_NOOPT
2756 ** --numstat Show change counts DIFF_NUMSTAT
2757 ** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR
2758 ** --unified Unified diff. ~DIFF_SIDEBYSIDE
2759 ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
2760 ** -W|--width N N character lines. DIFF_WIDTH_MASK
2761 ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
2762 ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
2763 */
2764 void diff_options(DiffConfig *pCfg, int isGDiff){
2765 u64 diffFlags = 0;
2766 const char *z;
2767 int f;
@@ -2837,18 +2837,18 @@
2837 ** See the "diff" command for a full list of command-line options.
2838 **
2839 ** This command used to be called "test-diff". The older "test-diff" spelling
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);
@@ -2858,17 +2858,17 @@
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
+31 -27
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -113,13 +113,15 @@
113113
}
114114
115115
/*
116116
** Print the "Index:" message that patches wants to see at the top of a diff.
117117
*/
118
-void diff_print_index(const char *zFile, u64 diffFlags, Blob *diffBlob){
119
- if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF|DIFF_NUMSTAT|DIFF_JSON|
120
- DIFF_WEBPAGE|DIFF_TCL))==0 ){
118
+void diff_print_index(const char *zFile, DiffConfig *pCfg, Blob *diffBlob){
119
+ if( (pCfg->diffFlags &
120
+ (DIFF_SIDEBYSIDE|DIFF_BRIEF|DIFF_NUMSTAT|DIFF_JSON|
121
+ DIFF_WEBPAGE|DIFF_TCL))==0
122
+ ){
121123
char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
122124
if( !diffBlob ){
123125
fossil_print("%s", z);
124126
}else{
125127
blob_appendf(diffBlob, "%s", z);
@@ -127,19 +129,21 @@
127129
fossil_free(z);
128130
}
129131
}
130132
131133
/*
132
-** Print the +++/--- filename lines for a diff operation.
134
+** Print the +++/--- filename lines or whatever filename information
135
+** is appropriate for the output format.
133136
*/
134137
void diff_print_filenames(
135
- const char *zLeft,
136
- const char *zRight,
137
- u64 diffFlags,
138
- Blob *diffBlob
138
+ const char *zLeft, /* Name of the left file */
139
+ const char *zRight, /* Name of the right file */
140
+ DiffConfig *pCfg, /* Diff configuration */
141
+ Blob *diffBlob /* Write to this blob, or stdout of this is NULL */
139142
){
140143
char *z = 0;
144
+ u64 diffFlags = pCfg->diffFlags;
141145
if( diffFlags & (DIFF_BRIEF|DIFF_RAW|DIFF_JSON) ){
142146
/* no-op */
143147
}else if( diffFlags & DIFF_DEBUG ){
144148
fossil_print("FILE-LEFT %s\nFILE-RIGHT %s\n",
145149
zLeft, zRight);
@@ -167,12 +171,11 @@
167171
fossil_print("%s", blob_str(pOut));
168172
blob_reset(&x);
169173
}
170174
return;
171175
}else if( diffFlags & DIFF_SIDEBYSIDE ){
172
- DiffConfig DCfg;
173
- int w = diff_width(diff_config_init(&DCfg,diffFlags));
176
+ int w = diff_width(pCfg);
174177
int n1 = strlen(zLeft);
175178
int n2 = strlen(zRight);
176179
int x;
177180
if( n1==n2 && fossil_strcmp(zLeft,zRight)==0 ){
178181
if( n1>w*2 ) n1 = w*2;
@@ -283,11 +286,13 @@
283286
@ </body>
284287
@ </html>
285288
;
286289
287290
/*
288
-** State variables used by the --browser option for diff
291
+** State variables used by the --browser option for diff. These must
292
+** be static variables, not elements of DiffConfig, since they are
293
+** used by the interrupt handler.
289294
*/
290295
static char *tempDiffFilename; /* File holding the diff HTML */
291296
static FILE *diffOut; /* Open to write into tempDiffFilename */
292297
293298
/* Amount of delay (in milliseconds) between launching the
@@ -322,12 +327,12 @@
322327
** hold the result. Make arrangements to delete that temporary
323328
** file if the diff is interrupted.
324329
**
325330
** For --browser and --webpage, output the HTML header.
326331
*/
327
-void diff_begin(u64 diffFlags){
328
- if( (diffFlags & DIFF_BROWSER)!=0 ){
332
+void diff_begin(DiffConfig *pCfg){
333
+ if( (pCfg->diffFlags & DIFF_BROWSER)!=0 ){
329334
tempDiffFilename = fossil_temp_filename();
330335
tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
331336
diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
332337
if( diffOut==0 ){
333338
fossil_fatal("unable to create temporary file \"%s\"",
@@ -337,11 +342,11 @@
337342
signal(SIGINT, diff_www_interrupt);
338343
#else
339344
SetConsoleCtrlHandler(diff_console_ctrl_handler, TRUE);
340345
#endif
341346
}
342
- if( (diffFlags & DIFF_WEBPAGE)!=0 ){
347
+ if( (pCfg->diffFlags & DIFF_WEBPAGE)!=0 ){
343348
fossil_print("%s",zWebpageHdr);
344349
fflush(stdout);
345350
}
346351
}
347352
@@ -353,19 +358,19 @@
353358
**
354359
** For --browser, close the connection to the temporary file, then
355360
** launch a web browser to view the file. After a delay
356361
** of FOSSIL_BROWSER_DIFF_DELAY milliseconds, delete the temp file.
357362
*/
358
-void diff_end(u64 diffFlags, int nErr){
359
- if( (diffFlags & DIFF_WEBPAGE)!=0 ){
360
- if( diffFlags & DIFF_SIDEBYSIDE ){
363
+void diff_end(DiffConfig *pCfg, int nErr){
364
+ if( (pCfg->diffFlags & DIFF_WEBPAGE)!=0 ){
365
+ if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
361366
const unsigned char *zJs = builtin_file("diff.js", 0);
362367
fossil_print("<script>\n%s</script>\n", zJs);
363368
}
364369
fossil_print("%s", zWebpageEnd);
365370
}
366
- if( (diffFlags & DIFF_BROWSER)!=0 && nErr==0 ){
371
+ if( (pCfg->diffFlags & DIFF_BROWSER)!=0 && nErr==0 ){
367372
char *zCmd = mprintf("%s %$", fossil_web_browser(), tempDiffFilename);
368373
fclose(diffOut);
369374
diffOut = fossil_freopen(NULL_DEVICE, "wb", stdout);
370375
fossil_system(zCmd);
371376
fossil_free(zCmd);
@@ -437,15 +442,14 @@
437442
fossil_print("%s %s\n", blob_str(&out), zName);
438443
}else{
439444
blob_appendf(diffBlob, "%s %s\n", blob_str(&out), zName);
440445
}
441446
}else{
447
+ diff_print_filenames(zName, zName2, pCfg, diffBlob);
442448
if( !diffBlob ){
443
- diff_print_filenames(zName, zName2, pCfg->diffFlags, 0);
444449
fossil_print("%s\n", blob_str(&out));
445450
}else{
446
- diff_print_filenames(zName, zName2, pCfg->diffFlags, diffBlob);
447451
blob_appendf(diffBlob, "%s\n", blob_str(&out));
448452
}
449453
}
450454
}
451455
blob_reset(&out);
@@ -541,11 +545,11 @@
541545
blob_zero(&out);
542546
text_diff(pFile1, pFile2, &out, 0, pCfg);
543547
if( pCfg->diffFlags & DIFF_NUMSTAT ){
544548
fossil_print("%s %s\n", blob_str(&out), zName);
545549
}else{
546
- diff_print_filenames(zName, zName, pCfg->diffFlags, 0);
550
+ diff_print_filenames(zName, zName, pCfg, 0);
547551
fossil_print("%s\n", blob_str(&out));
548552
}
549553
550554
/* Release memory resources */
551555
blob_reset(&out);
@@ -707,22 +711,22 @@
707711
}
708712
if( showDiff ){
709713
Blob content;
710714
int isBin;
711715
if( !isLink != !file_islink(zFullName) ){
712
- diff_print_index(zPathname, pCfg->diffFlags, 0);
713
- diff_print_filenames(zPathname, zPathname, pCfg->diffFlags, 0);
716
+ diff_print_index(zPathname, pCfg, 0);
717
+ diff_print_filenames(zPathname, zPathname, pCfg, 0);
714718
fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK);
715719
continue;
716720
}
717721
if( srcid>0 ){
718722
content_get(srcid, &content);
719723
}else{
720724
blob_zero(&content);
721725
}
722726
isBin = fIncludeBinary ? 0 : looks_like_binary(&content);
723
- diff_print_index(zPathname, pCfg->diffFlags, diffBlob);
727
+ diff_print_index(zPathname, pCfg, diffBlob);
724728
diff_file(&content, isBin, zFullName, zPathname, zDiffCmd,
725729
zBinGlob, fIncludeBinary, pCfg, 0, diffBlob);
726730
blob_reset(&content);
727731
}
728732
blob_reset(&fname);
@@ -795,11 +799,11 @@
795799
zName = pTo->zName;
796800
}else{
797801
zName = DIFF_NO_NAME;
798802
}
799803
if( pCfg->diffFlags & DIFF_BRIEF ) return;
800
- diff_print_index(zName, pCfg->diffFlags, 0);
804
+ diff_print_index(zName, pCfg, 0);
801805
if( pFrom ){
802806
rid = uuid_to_rid(pFrom->zUuid, 0);
803807
content_get(rid, &f1);
804808
}else{
805809
blob_zero(&f1);
@@ -1190,11 +1194,11 @@
11901194
ridTo);
11911195
if( zFrom==0 ){
11921196
fossil_fatal("check-in %s has no parent", zTo);
11931197
}
11941198
}
1195
- diff_begin(DCfg.diffFlags);
1199
+ diff_begin(&DCfg);
11961200
if( againstUndo ){
11971201
if( db_lget_int("undo_available",0)==0 ){
11981202
fossil_print("No undo or redo is available\n");
11991203
return;
12001204
}
@@ -1218,11 +1222,11 @@
12181222
}
12191223
fossil_free(pFileDir[i].zName);
12201224
}
12211225
fossil_free(pFileDir);
12221226
}
1223
- diff_end(DCfg.diffFlags, 0);
1227
+ diff_end(&DCfg, 0);
12241228
if ( DCfg.diffFlags & DIFF_NUMSTAT ){
12251229
fossil_print("%10d %10d TOTAL over %d changed files\n",
12261230
g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]);
12271231
}
12281232
}
12291233
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -113,13 +113,15 @@
113 }
114
115 /*
116 ** Print the "Index:" message that patches wants to see at the top of a diff.
117 */
118 void diff_print_index(const char *zFile, u64 diffFlags, Blob *diffBlob){
119 if( (diffFlags & (DIFF_SIDEBYSIDE|DIFF_BRIEF|DIFF_NUMSTAT|DIFF_JSON|
120 DIFF_WEBPAGE|DIFF_TCL))==0 ){
 
 
121 char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
122 if( !diffBlob ){
123 fossil_print("%s", z);
124 }else{
125 blob_appendf(diffBlob, "%s", z);
@@ -127,19 +129,21 @@
127 fossil_free(z);
128 }
129 }
130
131 /*
132 ** Print the +++/--- filename lines for a diff operation.
 
133 */
134 void diff_print_filenames(
135 const char *zLeft,
136 const char *zRight,
137 u64 diffFlags,
138 Blob *diffBlob
139 ){
140 char *z = 0;
 
141 if( diffFlags & (DIFF_BRIEF|DIFF_RAW|DIFF_JSON) ){
142 /* no-op */
143 }else if( diffFlags & DIFF_DEBUG ){
144 fossil_print("FILE-LEFT %s\nFILE-RIGHT %s\n",
145 zLeft, zRight);
@@ -167,12 +171,11 @@
167 fossil_print("%s", blob_str(pOut));
168 blob_reset(&x);
169 }
170 return;
171 }else if( diffFlags & DIFF_SIDEBYSIDE ){
172 DiffConfig DCfg;
173 int w = diff_width(diff_config_init(&DCfg,diffFlags));
174 int n1 = strlen(zLeft);
175 int n2 = strlen(zRight);
176 int x;
177 if( n1==n2 && fossil_strcmp(zLeft,zRight)==0 ){
178 if( n1>w*2 ) n1 = w*2;
@@ -283,11 +286,13 @@
283 @ </body>
284 @ </html>
285 ;
286
287 /*
288 ** State variables used by the --browser option for diff
 
 
289 */
290 static char *tempDiffFilename; /* File holding the diff HTML */
291 static FILE *diffOut; /* Open to write into tempDiffFilename */
292
293 /* Amount of delay (in milliseconds) between launching the
@@ -322,12 +327,12 @@
322 ** hold the result. Make arrangements to delete that temporary
323 ** file if the diff is interrupted.
324 **
325 ** For --browser and --webpage, output the HTML header.
326 */
327 void diff_begin(u64 diffFlags){
328 if( (diffFlags & DIFF_BROWSER)!=0 ){
329 tempDiffFilename = fossil_temp_filename();
330 tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
331 diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
332 if( diffOut==0 ){
333 fossil_fatal("unable to create temporary file \"%s\"",
@@ -337,11 +342,11 @@
337 signal(SIGINT, diff_www_interrupt);
338 #else
339 SetConsoleCtrlHandler(diff_console_ctrl_handler, TRUE);
340 #endif
341 }
342 if( (diffFlags & DIFF_WEBPAGE)!=0 ){
343 fossil_print("%s",zWebpageHdr);
344 fflush(stdout);
345 }
346 }
347
@@ -353,19 +358,19 @@
353 **
354 ** For --browser, close the connection to the temporary file, then
355 ** launch a web browser to view the file. After a delay
356 ** of FOSSIL_BROWSER_DIFF_DELAY milliseconds, delete the temp file.
357 */
358 void diff_end(u64 diffFlags, int nErr){
359 if( (diffFlags & DIFF_WEBPAGE)!=0 ){
360 if( diffFlags & DIFF_SIDEBYSIDE ){
361 const unsigned char *zJs = builtin_file("diff.js", 0);
362 fossil_print("<script>\n%s</script>\n", zJs);
363 }
364 fossil_print("%s", zWebpageEnd);
365 }
366 if( (diffFlags & DIFF_BROWSER)!=0 && nErr==0 ){
367 char *zCmd = mprintf("%s %$", fossil_web_browser(), tempDiffFilename);
368 fclose(diffOut);
369 diffOut = fossil_freopen(NULL_DEVICE, "wb", stdout);
370 fossil_system(zCmd);
371 fossil_free(zCmd);
@@ -437,15 +442,14 @@
437 fossil_print("%s %s\n", blob_str(&out), zName);
438 }else{
439 blob_appendf(diffBlob, "%s %s\n", blob_str(&out), zName);
440 }
441 }else{
 
442 if( !diffBlob ){
443 diff_print_filenames(zName, zName2, pCfg->diffFlags, 0);
444 fossil_print("%s\n", blob_str(&out));
445 }else{
446 diff_print_filenames(zName, zName2, pCfg->diffFlags, diffBlob);
447 blob_appendf(diffBlob, "%s\n", blob_str(&out));
448 }
449 }
450 }
451 blob_reset(&out);
@@ -541,11 +545,11 @@
541 blob_zero(&out);
542 text_diff(pFile1, pFile2, &out, 0, pCfg);
543 if( pCfg->diffFlags & DIFF_NUMSTAT ){
544 fossil_print("%s %s\n", blob_str(&out), zName);
545 }else{
546 diff_print_filenames(zName, zName, pCfg->diffFlags, 0);
547 fossil_print("%s\n", blob_str(&out));
548 }
549
550 /* Release memory resources */
551 blob_reset(&out);
@@ -707,22 +711,22 @@
707 }
708 if( showDiff ){
709 Blob content;
710 int isBin;
711 if( !isLink != !file_islink(zFullName) ){
712 diff_print_index(zPathname, pCfg->diffFlags, 0);
713 diff_print_filenames(zPathname, zPathname, pCfg->diffFlags, 0);
714 fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK);
715 continue;
716 }
717 if( srcid>0 ){
718 content_get(srcid, &content);
719 }else{
720 blob_zero(&content);
721 }
722 isBin = fIncludeBinary ? 0 : looks_like_binary(&content);
723 diff_print_index(zPathname, pCfg->diffFlags, diffBlob);
724 diff_file(&content, isBin, zFullName, zPathname, zDiffCmd,
725 zBinGlob, fIncludeBinary, pCfg, 0, diffBlob);
726 blob_reset(&content);
727 }
728 blob_reset(&fname);
@@ -795,11 +799,11 @@
795 zName = pTo->zName;
796 }else{
797 zName = DIFF_NO_NAME;
798 }
799 if( pCfg->diffFlags & DIFF_BRIEF ) return;
800 diff_print_index(zName, pCfg->diffFlags, 0);
801 if( pFrom ){
802 rid = uuid_to_rid(pFrom->zUuid, 0);
803 content_get(rid, &f1);
804 }else{
805 blob_zero(&f1);
@@ -1190,11 +1194,11 @@
1190 ridTo);
1191 if( zFrom==0 ){
1192 fossil_fatal("check-in %s has no parent", zTo);
1193 }
1194 }
1195 diff_begin(DCfg.diffFlags);
1196 if( againstUndo ){
1197 if( db_lget_int("undo_available",0)==0 ){
1198 fossil_print("No undo or redo is available\n");
1199 return;
1200 }
@@ -1218,11 +1222,11 @@
1218 }
1219 fossil_free(pFileDir[i].zName);
1220 }
1221 fossil_free(pFileDir);
1222 }
1223 diff_end(DCfg.diffFlags, 0);
1224 if ( DCfg.diffFlags & DIFF_NUMSTAT ){
1225 fossil_print("%10d %10d TOTAL over %d changed files\n",
1226 g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]);
1227 }
1228 }
1229
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -113,13 +113,15 @@
113 }
114
115 /*
116 ** Print the "Index:" message that patches wants to see at the top of a diff.
117 */
118 void diff_print_index(const char *zFile, DiffConfig *pCfg, Blob *diffBlob){
119 if( (pCfg->diffFlags &
120 (DIFF_SIDEBYSIDE|DIFF_BRIEF|DIFF_NUMSTAT|DIFF_JSON|
121 DIFF_WEBPAGE|DIFF_TCL))==0
122 ){
123 char *z = mprintf("Index: %s\n%.66c\n", zFile, '=');
124 if( !diffBlob ){
125 fossil_print("%s", z);
126 }else{
127 blob_appendf(diffBlob, "%s", z);
@@ -127,19 +129,21 @@
129 fossil_free(z);
130 }
131 }
132
133 /*
134 ** Print the +++/--- filename lines or whatever filename information
135 ** is appropriate for the output format.
136 */
137 void diff_print_filenames(
138 const char *zLeft, /* Name of the left file */
139 const char *zRight, /* Name of the right file */
140 DiffConfig *pCfg, /* Diff configuration */
141 Blob *diffBlob /* Write to this blob, or stdout of this is NULL */
142 ){
143 char *z = 0;
144 u64 diffFlags = pCfg->diffFlags;
145 if( diffFlags & (DIFF_BRIEF|DIFF_RAW|DIFF_JSON) ){
146 /* no-op */
147 }else if( diffFlags & DIFF_DEBUG ){
148 fossil_print("FILE-LEFT %s\nFILE-RIGHT %s\n",
149 zLeft, zRight);
@@ -167,12 +171,11 @@
171 fossil_print("%s", blob_str(pOut));
172 blob_reset(&x);
173 }
174 return;
175 }else if( diffFlags & DIFF_SIDEBYSIDE ){
176 int w = diff_width(pCfg);
 
177 int n1 = strlen(zLeft);
178 int n2 = strlen(zRight);
179 int x;
180 if( n1==n2 && fossil_strcmp(zLeft,zRight)==0 ){
181 if( n1>w*2 ) n1 = w*2;
@@ -283,11 +286,13 @@
286 @ </body>
287 @ </html>
288 ;
289
290 /*
291 ** State variables used by the --browser option for diff. These must
292 ** be static variables, not elements of DiffConfig, since they are
293 ** used by the interrupt handler.
294 */
295 static char *tempDiffFilename; /* File holding the diff HTML */
296 static FILE *diffOut; /* Open to write into tempDiffFilename */
297
298 /* Amount of delay (in milliseconds) between launching the
@@ -322,12 +327,12 @@
327 ** hold the result. Make arrangements to delete that temporary
328 ** file if the diff is interrupted.
329 **
330 ** For --browser and --webpage, output the HTML header.
331 */
332 void diff_begin(DiffConfig *pCfg){
333 if( (pCfg->diffFlags & DIFF_BROWSER)!=0 ){
334 tempDiffFilename = fossil_temp_filename();
335 tempDiffFilename = sqlite3_mprintf("%z.html", tempDiffFilename);
336 diffOut = fossil_freopen(tempDiffFilename,"wb",stdout);
337 if( diffOut==0 ){
338 fossil_fatal("unable to create temporary file \"%s\"",
@@ -337,11 +342,11 @@
342 signal(SIGINT, diff_www_interrupt);
343 #else
344 SetConsoleCtrlHandler(diff_console_ctrl_handler, TRUE);
345 #endif
346 }
347 if( (pCfg->diffFlags & DIFF_WEBPAGE)!=0 ){
348 fossil_print("%s",zWebpageHdr);
349 fflush(stdout);
350 }
351 }
352
@@ -353,19 +358,19 @@
358 **
359 ** For --browser, close the connection to the temporary file, then
360 ** launch a web browser to view the file. After a delay
361 ** of FOSSIL_BROWSER_DIFF_DELAY milliseconds, delete the temp file.
362 */
363 void diff_end(DiffConfig *pCfg, int nErr){
364 if( (pCfg->diffFlags & DIFF_WEBPAGE)!=0 ){
365 if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){
366 const unsigned char *zJs = builtin_file("diff.js", 0);
367 fossil_print("<script>\n%s</script>\n", zJs);
368 }
369 fossil_print("%s", zWebpageEnd);
370 }
371 if( (pCfg->diffFlags & DIFF_BROWSER)!=0 && nErr==0 ){
372 char *zCmd = mprintf("%s %$", fossil_web_browser(), tempDiffFilename);
373 fclose(diffOut);
374 diffOut = fossil_freopen(NULL_DEVICE, "wb", stdout);
375 fossil_system(zCmd);
376 fossil_free(zCmd);
@@ -437,15 +442,14 @@
442 fossil_print("%s %s\n", blob_str(&out), zName);
443 }else{
444 blob_appendf(diffBlob, "%s %s\n", blob_str(&out), zName);
445 }
446 }else{
447 diff_print_filenames(zName, zName2, pCfg, diffBlob);
448 if( !diffBlob ){
 
449 fossil_print("%s\n", blob_str(&out));
450 }else{
 
451 blob_appendf(diffBlob, "%s\n", blob_str(&out));
452 }
453 }
454 }
455 blob_reset(&out);
@@ -541,11 +545,11 @@
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 }
553
554 /* Release memory resources */
555 blob_reset(&out);
@@ -707,22 +711,22 @@
711 }
712 if( showDiff ){
713 Blob content;
714 int isBin;
715 if( !isLink != !file_islink(zFullName) ){
716 diff_print_index(zPathname, pCfg, 0);
717 diff_print_filenames(zPathname, zPathname, pCfg, 0);
718 fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK);
719 continue;
720 }
721 if( srcid>0 ){
722 content_get(srcid, &content);
723 }else{
724 blob_zero(&content);
725 }
726 isBin = fIncludeBinary ? 0 : looks_like_binary(&content);
727 diff_print_index(zPathname, pCfg, diffBlob);
728 diff_file(&content, isBin, zFullName, zPathname, zDiffCmd,
729 zBinGlob, fIncludeBinary, pCfg, 0, diffBlob);
730 blob_reset(&content);
731 }
732 blob_reset(&fname);
@@ -795,11 +799,11 @@
799 zName = pTo->zName;
800 }else{
801 zName = DIFF_NO_NAME;
802 }
803 if( pCfg->diffFlags & DIFF_BRIEF ) return;
804 diff_print_index(zName, pCfg, 0);
805 if( pFrom ){
806 rid = uuid_to_rid(pFrom->zUuid, 0);
807 content_get(rid, &f1);
808 }else{
809 blob_zero(&f1);
@@ -1190,11 +1194,11 @@
1194 ridTo);
1195 if( zFrom==0 ){
1196 fossil_fatal("check-in %s has no parent", zTo);
1197 }
1198 }
1199 diff_begin(&DCfg);
1200 if( againstUndo ){
1201 if( db_lget_int("undo_available",0)==0 ){
1202 fossil_print("No undo or redo is available\n");
1203 return;
1204 }
@@ -1218,11 +1222,11 @@
1222 }
1223 fossil_free(pFileDir[i].zName);
1224 }
1225 fossil_free(pFileDir);
1226 }
1227 diff_end(&DCfg, 0);
1228 if ( DCfg.diffFlags & DIFF_NUMSTAT ){
1229 fossil_print("%10d %10d TOTAL over %d changed files\n",
1230 g.diffCnt[1], g.diffCnt[2], g.diffCnt[0]);
1231 }
1232 }
1233
+4 -4
--- src/patch.c
+++ src/patch.c
@@ -764,11 +764,11 @@
764764
"in the %s repository", zBaseline, g.zRepositoryName);
765765
}
766766
}
767767
}
768768
769
- diff_begin(pCfg->diffFlags);
769
+ diff_begin(pCfg);
770770
db_prepare(&q,
771771
"SELECT"
772772
" (SELECT blob.rid FROM blob WHERE blob.uuid=chng.hash),"
773773
" pathname," /* 1: new pathname */
774774
" origname," /* 2: original pathname. Null if not renamed */
@@ -804,21 +804,21 @@
804804
zName = db_column_text(&q, 1);
805805
rid = db_column_int(&q, 0);
806806
807807
if( db_column_type(&q,3)==SQLITE_NULL ){
808808
if( !bWebpage ) fossil_print("DELETE %s\n", zName);
809
- diff_print_index(zName, pCfg->diffFlags, 0);
809
+ diff_print_index(zName, pCfg, 0);
810810
isBin2 = 0;
811811
content_get(rid, &a);
812812
isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
813813
diff_file_mem(&a, &empty, isBin1, isBin2, zName, zDiffCmd,
814814
zBinGlob, fIncludeBinary, pCfg);
815815
}else if( rid==0 ){
816816
db_ephemeral_blob(&q, 3, &a);
817817
blob_uncompress(&a, &a);
818818
if( !bWebpage ) fossil_print("ADDED %s\n", zName);
819
- diff_print_index(zName, pCfg->diffFlags, 0);
819
+ diff_print_index(zName, pCfg, 0);
820820
isBin1 = 0;
821821
isBin2 = fIncludeBinary ? 0 : looks_like_binary(&a);
822822
diff_file_mem(&empty, &a, isBin1, isBin2, zName, zDiffCmd,
823823
zBinGlob, fIncludeBinary, pCfg);
824824
blob_reset(&a);
@@ -836,11 +836,11 @@
836836
blob_reset(&b);
837837
blob_reset(&delta);
838838
}
839839
}
840840
db_finalize(&q);
841
- diff_end(pCfg->diffFlags, nErr);
841
+ diff_end(pCfg, nErr);
842842
if( nErr ) fossil_fatal("abort due to prior errors");
843843
}
844844
845845
846846
/*
847847
--- src/patch.c
+++ src/patch.c
@@ -764,11 +764,11 @@
764 "in the %s repository", zBaseline, g.zRepositoryName);
765 }
766 }
767 }
768
769 diff_begin(pCfg->diffFlags);
770 db_prepare(&q,
771 "SELECT"
772 " (SELECT blob.rid FROM blob WHERE blob.uuid=chng.hash),"
773 " pathname," /* 1: new pathname */
774 " origname," /* 2: original pathname. Null if not renamed */
@@ -804,21 +804,21 @@
804 zName = db_column_text(&q, 1);
805 rid = db_column_int(&q, 0);
806
807 if( db_column_type(&q,3)==SQLITE_NULL ){
808 if( !bWebpage ) fossil_print("DELETE %s\n", zName);
809 diff_print_index(zName, pCfg->diffFlags, 0);
810 isBin2 = 0;
811 content_get(rid, &a);
812 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
813 diff_file_mem(&a, &empty, isBin1, isBin2, zName, zDiffCmd,
814 zBinGlob, fIncludeBinary, pCfg);
815 }else if( rid==0 ){
816 db_ephemeral_blob(&q, 3, &a);
817 blob_uncompress(&a, &a);
818 if( !bWebpage ) fossil_print("ADDED %s\n", zName);
819 diff_print_index(zName, pCfg->diffFlags, 0);
820 isBin1 = 0;
821 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&a);
822 diff_file_mem(&empty, &a, isBin1, isBin2, zName, zDiffCmd,
823 zBinGlob, fIncludeBinary, pCfg);
824 blob_reset(&a);
@@ -836,11 +836,11 @@
836 blob_reset(&b);
837 blob_reset(&delta);
838 }
839 }
840 db_finalize(&q);
841 diff_end(pCfg->diffFlags, nErr);
842 if( nErr ) fossil_fatal("abort due to prior errors");
843 }
844
845
846 /*
847
--- src/patch.c
+++ src/patch.c
@@ -764,11 +764,11 @@
764 "in the %s repository", zBaseline, g.zRepositoryName);
765 }
766 }
767 }
768
769 diff_begin(pCfg);
770 db_prepare(&q,
771 "SELECT"
772 " (SELECT blob.rid FROM blob WHERE blob.uuid=chng.hash),"
773 " pathname," /* 1: new pathname */
774 " origname," /* 2: original pathname. Null if not renamed */
@@ -804,21 +804,21 @@
804 zName = db_column_text(&q, 1);
805 rid = db_column_int(&q, 0);
806
807 if( db_column_type(&q,3)==SQLITE_NULL ){
808 if( !bWebpage ) fossil_print("DELETE %s\n", zName);
809 diff_print_index(zName, pCfg, 0);
810 isBin2 = 0;
811 content_get(rid, &a);
812 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
813 diff_file_mem(&a, &empty, isBin1, isBin2, zName, zDiffCmd,
814 zBinGlob, fIncludeBinary, pCfg);
815 }else if( rid==0 ){
816 db_ephemeral_blob(&q, 3, &a);
817 blob_uncompress(&a, &a);
818 if( !bWebpage ) fossil_print("ADDED %s\n", zName);
819 diff_print_index(zName, pCfg, 0);
820 isBin1 = 0;
821 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&a);
822 diff_file_mem(&empty, &a, isBin1, isBin2, zName, zDiffCmd,
823 zBinGlob, fIncludeBinary, pCfg);
824 blob_reset(&a);
@@ -836,11 +836,11 @@
836 blob_reset(&b);
837 blob_reset(&delta);
838 }
839 }
840 db_finalize(&q);
841 diff_end(pCfg, nErr);
842 if( nErr ) fossil_fatal("abort due to prior errors");
843 }
844
845
846 /*
847
+6 -6
--- src/stash.c
+++ src/stash.c
@@ -412,11 +412,11 @@
412412
){
413413
Stmt q;
414414
Blob empty;
415415
int bWebpage = (pCfg->diffFlags & DIFF_WEBPAGE)!=0;
416416
blob_zero(&empty);
417
- diff_begin(pCfg->diffFlags);
417
+ diff_begin(pCfg);
418418
db_prepare(&q,
419419
"SELECT blob.rid, isRemoved, isExec, isLink, origname, newname, delta"
420420
" FROM stashfile, blob WHERE stashid=%d AND blob.uuid=stashfile.hash",
421421
stashid
422422
);
@@ -430,18 +430,18 @@
430430
char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
431431
Blob a, b;
432432
if( rid==0 ){
433433
db_ephemeral_blob(&q, 6, &a);
434434
if( !bWebpage ) fossil_print("ADDED %s\n", zNew);
435
- diff_print_index(zNew, pCfg->diffFlags, 0);
435
+ diff_print_index(zNew, pCfg, 0);
436436
isBin1 = 0;
437437
isBin2 = fIncludeBinary ? 0 : looks_like_binary(&a);
438438
diff_file_mem(&empty, &a, isBin1, isBin2, zNew, zDiffCmd,
439439
zBinGlob, fIncludeBinary, pCfg);
440440
}else if( isRemoved ){
441441
if( !bWebpage) fossil_print("DELETE %s\n", zOrig);
442
- diff_print_index(zNew, pCfg->diffFlags, 0);
442
+ diff_print_index(zNew, pCfg, 0);
443443
isBin2 = 0;
444444
if( fBaseline ){
445445
content_get(rid, &a);
446446
isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
447447
diff_file_mem(&a, &empty, isBin1, isBin2, zOrig, zDiffCmd,
@@ -451,12 +451,12 @@
451451
Blob delta;
452452
int isOrigLink = file_islink(zOPath);
453453
db_ephemeral_blob(&q, 6, &delta);
454454
if( !bWebpage ) fossil_print("CHANGED %s\n", zNew);
455455
if( !isOrigLink != !isLink ){
456
- diff_print_index(zNew, pCfg->diffFlags, 0);
457
- diff_print_filenames(zOrig, zNew, pCfg->diffFlags, 0);
456
+ diff_print_index(zNew, pCfg, 0);
457
+ diff_print_filenames(zOrig, zNew, pCfg, 0);
458458
printf(DIFF_CANNOT_COMPUTE_SYMLINK);
459459
}else{
460460
content_get(rid, &a);
461461
blob_delta_apply(&a, &delta, &b);
462462
isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
@@ -475,11 +475,11 @@
475475
}
476476
blob_reset(&delta);
477477
}
478478
}
479479
db_finalize(&q);
480
- diff_end(pCfg->diffFlags, 0);
480
+ diff_end(pCfg, 0);
481481
}
482482
483483
/*
484484
** Drop the indicated stash
485485
*/
486486
--- src/stash.c
+++ src/stash.c
@@ -412,11 +412,11 @@
412 ){
413 Stmt q;
414 Blob empty;
415 int bWebpage = (pCfg->diffFlags & DIFF_WEBPAGE)!=0;
416 blob_zero(&empty);
417 diff_begin(pCfg->diffFlags);
418 db_prepare(&q,
419 "SELECT blob.rid, isRemoved, isExec, isLink, origname, newname, delta"
420 " FROM stashfile, blob WHERE stashid=%d AND blob.uuid=stashfile.hash",
421 stashid
422 );
@@ -430,18 +430,18 @@
430 char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
431 Blob a, b;
432 if( rid==0 ){
433 db_ephemeral_blob(&q, 6, &a);
434 if( !bWebpage ) fossil_print("ADDED %s\n", zNew);
435 diff_print_index(zNew, pCfg->diffFlags, 0);
436 isBin1 = 0;
437 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&a);
438 diff_file_mem(&empty, &a, isBin1, isBin2, zNew, zDiffCmd,
439 zBinGlob, fIncludeBinary, pCfg);
440 }else if( isRemoved ){
441 if( !bWebpage) fossil_print("DELETE %s\n", zOrig);
442 diff_print_index(zNew, pCfg->diffFlags, 0);
443 isBin2 = 0;
444 if( fBaseline ){
445 content_get(rid, &a);
446 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
447 diff_file_mem(&a, &empty, isBin1, isBin2, zOrig, zDiffCmd,
@@ -451,12 +451,12 @@
451 Blob delta;
452 int isOrigLink = file_islink(zOPath);
453 db_ephemeral_blob(&q, 6, &delta);
454 if( !bWebpage ) fossil_print("CHANGED %s\n", zNew);
455 if( !isOrigLink != !isLink ){
456 diff_print_index(zNew, pCfg->diffFlags, 0);
457 diff_print_filenames(zOrig, zNew, pCfg->diffFlags, 0);
458 printf(DIFF_CANNOT_COMPUTE_SYMLINK);
459 }else{
460 content_get(rid, &a);
461 blob_delta_apply(&a, &delta, &b);
462 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
@@ -475,11 +475,11 @@
475 }
476 blob_reset(&delta);
477 }
478 }
479 db_finalize(&q);
480 diff_end(pCfg->diffFlags, 0);
481 }
482
483 /*
484 ** Drop the indicated stash
485 */
486
--- src/stash.c
+++ src/stash.c
@@ -412,11 +412,11 @@
412 ){
413 Stmt q;
414 Blob empty;
415 int bWebpage = (pCfg->diffFlags & DIFF_WEBPAGE)!=0;
416 blob_zero(&empty);
417 diff_begin(pCfg);
418 db_prepare(&q,
419 "SELECT blob.rid, isRemoved, isExec, isLink, origname, newname, delta"
420 " FROM stashfile, blob WHERE stashid=%d AND blob.uuid=stashfile.hash",
421 stashid
422 );
@@ -430,18 +430,18 @@
430 char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
431 Blob a, b;
432 if( rid==0 ){
433 db_ephemeral_blob(&q, 6, &a);
434 if( !bWebpage ) fossil_print("ADDED %s\n", zNew);
435 diff_print_index(zNew, pCfg, 0);
436 isBin1 = 0;
437 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&a);
438 diff_file_mem(&empty, &a, isBin1, isBin2, zNew, zDiffCmd,
439 zBinGlob, fIncludeBinary, pCfg);
440 }else if( isRemoved ){
441 if( !bWebpage) fossil_print("DELETE %s\n", zOrig);
442 diff_print_index(zNew, pCfg, 0);
443 isBin2 = 0;
444 if( fBaseline ){
445 content_get(rid, &a);
446 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
447 diff_file_mem(&a, &empty, isBin1, isBin2, zOrig, zDiffCmd,
@@ -451,12 +451,12 @@
451 Blob delta;
452 int isOrigLink = file_islink(zOPath);
453 db_ephemeral_blob(&q, 6, &delta);
454 if( !bWebpage ) fossil_print("CHANGED %s\n", zNew);
455 if( !isOrigLink != !isLink ){
456 diff_print_index(zNew, pCfg, 0);
457 diff_print_filenames(zOrig, zNew, pCfg, 0);
458 printf(DIFF_CANNOT_COMPUTE_SYMLINK);
459 }else{
460 content_get(rid, &a);
461 blob_delta_apply(&a, &delta, &b);
462 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
@@ -475,11 +475,11 @@
475 }
476 blob_reset(&delta);
477 }
478 }
479 db_finalize(&q);
480 diff_end(pCfg, 0);
481 }
482
483 /*
484 ** Drop the indicated stash
485 */
486

Keyboard Shortcuts

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