Fossil SCM

Move more diff parameters into the DiffConfig object.

drh 2021-09-07 00:18 trunk
Commit 346de5d122a2c28c6d1a3896a5fdc076cb1787d7506bbe918f83112b1042373c
+4 -7
--- src/checkin.c
+++ src/checkin.c
@@ -1344,11 +1344,12 @@
13441344
blob_appendf(&prompt,
13451345
"#\n%.78c\n"
13461346
"# The following diff is excluded from the commit message:\n#\n",
13471347
'#'
13481348
);
1349
- diff_config_init(&DCfg, DIFF_VERBOSE);
1349
+ diff_options(&DCfg, 0, 1);
1350
+ DCfg.diffFlags |= DIFF_VERBOSE;
13501351
if( g.aCommitFile ){
13511352
FileDirList *diffFiles;
13521353
int i;
13531354
diffFiles = fossil_malloc_zero((g.argc-1) * sizeof(*diffFiles));
13541355
for( i=0; g.aCommitFile[i]!=0; ++i ){
@@ -1360,21 +1361,17 @@
13601361
break;
13611362
}
13621363
diffFiles[i].nName = strlen(diffFiles[i].zName);
13631364
diffFiles[i].nUsed = 0;
13641365
}
1365
- diff_against_disk(0, 0, diff_get_binary_glob(),
1366
- db_get_boolean("diff-binary", 1),
1367
- &DCfg, diffFiles, &prompt);
1366
+ diff_against_disk(0, &DCfg, diffFiles, &prompt);
13681367
for( i=0; diffFiles[i].zName; ++i ){
13691368
fossil_free(diffFiles[i].zName);
13701369
}
13711370
fossil_free(diffFiles);
13721371
}else{
1373
- diff_against_disk(0, 0, diff_get_binary_glob(),
1374
- db_get_boolean("diff-binary", 1),
1375
- &DCfg, 0, &prompt);
1372
+ diff_against_disk(0, &DCfg, 0, &prompt);
13761373
}
13771374
}
13781375
prompt_for_user_comment(pComment, &prompt);
13791376
blob_reset(&prompt);
13801377
}
13811378
--- src/checkin.c
+++ src/checkin.c
@@ -1344,11 +1344,12 @@
1344 blob_appendf(&prompt,
1345 "#\n%.78c\n"
1346 "# The following diff is excluded from the commit message:\n#\n",
1347 '#'
1348 );
1349 diff_config_init(&DCfg, DIFF_VERBOSE);
 
1350 if( g.aCommitFile ){
1351 FileDirList *diffFiles;
1352 int i;
1353 diffFiles = fossil_malloc_zero((g.argc-1) * sizeof(*diffFiles));
1354 for( i=0; g.aCommitFile[i]!=0; ++i ){
@@ -1360,21 +1361,17 @@
1360 break;
1361 }
1362 diffFiles[i].nName = strlen(diffFiles[i].zName);
1363 diffFiles[i].nUsed = 0;
1364 }
1365 diff_against_disk(0, 0, diff_get_binary_glob(),
1366 db_get_boolean("diff-binary", 1),
1367 &DCfg, diffFiles, &prompt);
1368 for( i=0; diffFiles[i].zName; ++i ){
1369 fossil_free(diffFiles[i].zName);
1370 }
1371 fossil_free(diffFiles);
1372 }else{
1373 diff_against_disk(0, 0, diff_get_binary_glob(),
1374 db_get_boolean("diff-binary", 1),
1375 &DCfg, 0, &prompt);
1376 }
1377 }
1378 prompt_for_user_comment(pComment, &prompt);
1379 blob_reset(&prompt);
1380 }
1381
--- src/checkin.c
+++ src/checkin.c
@@ -1344,11 +1344,12 @@
1344 blob_appendf(&prompt,
1345 "#\n%.78c\n"
1346 "# The following diff is excluded from the commit message:\n#\n",
1347 '#'
1348 );
1349 diff_options(&DCfg, 0, 1);
1350 DCfg.diffFlags |= DIFF_VERBOSE;
1351 if( g.aCommitFile ){
1352 FileDirList *diffFiles;
1353 int i;
1354 diffFiles = fossil_malloc_zero((g.argc-1) * sizeof(*diffFiles));
1355 for( i=0; g.aCommitFile[i]!=0; ++i ){
@@ -1360,21 +1361,17 @@
1361 break;
1362 }
1363 diffFiles[i].nName = strlen(diffFiles[i].zName);
1364 diffFiles[i].nUsed = 0;
1365 }
1366 diff_against_disk(0, &DCfg, diffFiles, &prompt);
 
 
1367 for( i=0; diffFiles[i].zName; ++i ){
1368 fossil_free(diffFiles[i].zName);
1369 }
1370 fossil_free(diffFiles);
1371 }else{
1372 diff_against_disk(0, &DCfg, 0, &prompt);
 
 
1373 }
1374 }
1375 prompt_for_user_comment(pComment, &prompt);
1376 blob_reset(&prompt);
1377 }
1378
+48 -28
--- src/diff.c
+++ src/diff.c
@@ -48,10 +48,11 @@
4848
#define DIFF_BROWSER (((u64)0x00080)<<32) /* The --browser option */
4949
#define DIFF_JSON (((u64)0x00100)<<32) /* JSON output */
5050
#define DIFF_DEBUG (((u64)0x00200)<<32) /* Debugging diff output */
5151
#define DIFF_RAW (((u64)0x00400)<<32) /* Raw triples - for debugging */
5252
#define DIFF_TCL (((u64)0x00800)<<32) /* For the --tk option */
53
+#define DIFF_INCBINARY (((u64)0x01000)<<32) /* The --diff-binary option */
5354
5455
/*
5556
** These error messages are shared in multiple locations. They are defined
5657
** here for consistency.
5758
*/
@@ -2761,11 +2762,11 @@
27612762
** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
27622763
** -W|--width N N character lines. DIFF_WIDTH_MASK
27632764
** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
27642765
** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
27652766
*/
2766
-void diff_options(DiffConfig *pCfg, int isGDiff){
2767
+void diff_options(DiffConfig *pCfg, int isGDiff, int bUnifiedTextOnly){
27672768
u64 diffFlags = 0;
27682769
const char *z;
27692770
int f;
27702771
27712772
memset(pCfg, 0, sizeof(*pCfg));
@@ -2776,51 +2777,70 @@
27762777
diffFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
27772778
}
27782779
if( find_option("strip-trailing-cr",0,0)!=0 ){
27792780
diffFlags |= DIFF_STRIP_EOLCR;
27802781
}
2781
- if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
2782
- if( find_option("yy",0,0)!=0 ){
2783
- diffFlags |= DIFF_SIDEBYSIDE | DIFF_SLOW_SBS;
2782
+ if( !bUnifiedTextOnly ){
2783
+ if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
2784
+ if( find_option("yy",0,0)!=0 ){
2785
+ diffFlags |= DIFF_SIDEBYSIDE | DIFF_SLOW_SBS;
2786
+ }
2787
+ if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML;
2788
+ if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
2789
+ if( find_option("webpage",0,0)!=0 ){
2790
+ diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO;
2791
+ }
2792
+ if( find_option("browser","b",0)!=0 ){
2793
+ diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO|DIFF_BROWSER;
2794
+ }
2795
+ if( find_option("by",0,0)!=0 ){
2796
+ diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO|DIFF_BROWSER
2797
+ |DIFF_SIDEBYSIDE;
2798
+ }
2799
+ if( find_option("json",0,0)!=0 ){
2800
+ diffFlags |= DIFF_JSON;
2801
+ }
2802
+ if( find_option("tcl",0,0)!=0 ){
2803
+ diffFlags |= DIFF_TCL;
2804
+ }
2805
+
2806
+ /* Undocumented and unsupported flags used for development
2807
+ ** debugging and analysis: */
2808
+ if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
2809
+ if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
27842810
}
2785
- if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
27862811
if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
27872812
if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
27882813
diffFlags |= f + DIFF_CONTEXT_EX;
27892814
}
27902815
if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
27912816
f *= DIFF_CONTEXT_MASK+1;
27922817
if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK;
27932818
diffFlags |= f;
27942819
}
2795
- if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML;
27962820
if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
27972821
if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT;
27982822
if( find_option("numstat",0,0)!=0 ) diffFlags |= DIFF_NUMSTAT;
27992823
if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT;
28002824
if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF;
2801
- if( find_option("webpage",0,0)!=0 ){
2802
- diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO;
2803
- }
2804
- if( find_option("browser","b",0)!=0 ){
2805
- diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO|DIFF_BROWSER;
2806
- }
2807
- if( find_option("by",0,0)!=0 ){
2808
- diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO|DIFF_BROWSER
2809
- |DIFF_SIDEBYSIDE;
2810
- }
2811
- if( find_option("json",0,0)!=0 ){
2812
- diffFlags |= DIFF_JSON;
2813
- }
2814
- if( find_option("tcl",0,0)!=0 ){
2815
- diffFlags |= DIFF_TCL;
2816
- }
2817
-
2818
- /* Undocumented and unsupported flags used for development
2819
- ** debugging and analysis: */
2820
- if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
2821
- if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
2825
+ if( find_option("internal","i",0)==0
2826
+ && (diffFlags & (DIFF_HTML|DIFF_TCL|DIFF_DEBUG|DIFF_JSON))==0
2827
+ ){
2828
+ pCfg->zDiffCmd = diff_command_external(isGDiff);
2829
+ if( pCfg->zDiffCmd ){
2830
+ const char *zDiffBinary;
2831
+ pCfg->zBinGlob = diff_get_binary_glob();
2832
+ zDiffBinary = find_option("diff-binary", 0, 1);
2833
+ if( zDiffBinary ){
2834
+ if( is_truth(zDiffBinary) ) diffFlags |= DIFF_INCBINARY;
2835
+ }else if( db_get_boolean("diff-binary", 1) ){
2836
+ diffFlags |= DIFF_INCBINARY;
2837
+ }
2838
+ }
2839
+ }
2840
+ if( find_option("verbose","v",0)!=0 ) diffFlags |= DIFF_VERBOSE;
2841
+
28222842
pCfg->diffFlags = diffFlags;
28232843
}
28242844
28252845
/*
28262846
** COMMAND: test-diff
@@ -2850,11 +2870,11 @@
28502870
diff_tk("xdiff", 2);
28512871
return;
28522872
}
28532873
find_option("i",0,0);
28542874
find_option("v",0,0);
2855
- diff_options(&DCfg, 0);
2875
+ diff_options(&DCfg, 0, 0);
28562876
zRe = find_option("regexp","e",1);
28572877
if( zRe ){
28582878
const char *zErr = re_compile(&DCfg.pRe, zRe, 0);
28592879
if( zErr ) fossil_fatal("regex error: %s", zErr);
28602880
}
28612881
--- src/diff.c
+++ src/diff.c
@@ -48,10 +48,11 @@
48 #define DIFF_BROWSER (((u64)0x00080)<<32) /* The --browser option */
49 #define DIFF_JSON (((u64)0x00100)<<32) /* JSON output */
50 #define DIFF_DEBUG (((u64)0x00200)<<32) /* Debugging diff output */
51 #define DIFF_RAW (((u64)0x00400)<<32) /* Raw triples - for debugging */
52 #define DIFF_TCL (((u64)0x00800)<<32) /* For the --tk option */
 
53
54 /*
55 ** These error messages are shared in multiple locations. They are defined
56 ** here for consistency.
57 */
@@ -2761,11 +2762,11 @@
2761 ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
2762 ** -W|--width N N character lines. DIFF_WIDTH_MASK
2763 ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
2764 ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
2765 */
2766 void diff_options(DiffConfig *pCfg, int isGDiff){
2767 u64 diffFlags = 0;
2768 const char *z;
2769 int f;
2770
2771 memset(pCfg, 0, sizeof(*pCfg));
@@ -2776,51 +2777,70 @@
2776 diffFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
2777 }
2778 if( find_option("strip-trailing-cr",0,0)!=0 ){
2779 diffFlags |= DIFF_STRIP_EOLCR;
2780 }
2781 if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
2782 if( find_option("yy",0,0)!=0 ){
2783 diffFlags |= DIFF_SIDEBYSIDE | DIFF_SLOW_SBS;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2784 }
2785 if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
2786 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
2787 if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
2788 diffFlags |= f + DIFF_CONTEXT_EX;
2789 }
2790 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
2791 f *= DIFF_CONTEXT_MASK+1;
2792 if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK;
2793 diffFlags |= f;
2794 }
2795 if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML;
2796 if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
2797 if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT;
2798 if( find_option("numstat",0,0)!=0 ) diffFlags |= DIFF_NUMSTAT;
2799 if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT;
2800 if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF;
2801 if( find_option("webpage",0,0)!=0 ){
2802 diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO;
2803 }
2804 if( find_option("browser","b",0)!=0 ){
2805 diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO|DIFF_BROWSER;
2806 }
2807 if( find_option("by",0,0)!=0 ){
2808 diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO|DIFF_BROWSER
2809 |DIFF_SIDEBYSIDE;
2810 }
2811 if( find_option("json",0,0)!=0 ){
2812 diffFlags |= DIFF_JSON;
2813 }
2814 if( find_option("tcl",0,0)!=0 ){
2815 diffFlags |= DIFF_TCL;
2816 }
2817
2818 /* Undocumented and unsupported flags used for development
2819 ** debugging and analysis: */
2820 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
2821 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
2822 pCfg->diffFlags = diffFlags;
2823 }
2824
2825 /*
2826 ** COMMAND: test-diff
@@ -2850,11 +2870,11 @@
2850 diff_tk("xdiff", 2);
2851 return;
2852 }
2853 find_option("i",0,0);
2854 find_option("v",0,0);
2855 diff_options(&DCfg, 0);
2856 zRe = find_option("regexp","e",1);
2857 if( zRe ){
2858 const char *zErr = re_compile(&DCfg.pRe, zRe, 0);
2859 if( zErr ) fossil_fatal("regex error: %s", zErr);
2860 }
2861
--- src/diff.c
+++ src/diff.c
@@ -48,10 +48,11 @@
48 #define DIFF_BROWSER (((u64)0x00080)<<32) /* The --browser option */
49 #define DIFF_JSON (((u64)0x00100)<<32) /* JSON output */
50 #define DIFF_DEBUG (((u64)0x00200)<<32) /* Debugging diff output */
51 #define DIFF_RAW (((u64)0x00400)<<32) /* Raw triples - for debugging */
52 #define DIFF_TCL (((u64)0x00800)<<32) /* For the --tk option */
53 #define DIFF_INCBINARY (((u64)0x01000)<<32) /* The --diff-binary option */
54
55 /*
56 ** These error messages are shared in multiple locations. They are defined
57 ** here for consistency.
58 */
@@ -2761,11 +2762,11 @@
2762 ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS
2763 ** -W|--width N N character lines. DIFF_WIDTH_MASK
2764 ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE
2765 ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS
2766 */
2767 void diff_options(DiffConfig *pCfg, int isGDiff, int bUnifiedTextOnly){
2768 u64 diffFlags = 0;
2769 const char *z;
2770 int f;
2771
2772 memset(pCfg, 0, sizeof(*pCfg));
@@ -2776,51 +2777,70 @@
2777 diffFlags = DIFF_IGNORE_ALLWS; /* stronger than DIFF_IGNORE_EOLWS */
2778 }
2779 if( find_option("strip-trailing-cr",0,0)!=0 ){
2780 diffFlags |= DIFF_STRIP_EOLCR;
2781 }
2782 if( !bUnifiedTextOnly ){
2783 if( find_option("side-by-side","y",0)!=0 ) diffFlags |= DIFF_SIDEBYSIDE;
2784 if( find_option("yy",0,0)!=0 ){
2785 diffFlags |= DIFF_SIDEBYSIDE | DIFF_SLOW_SBS;
2786 }
2787 if( find_option("html",0,0)!=0 ) diffFlags |= DIFF_HTML;
2788 if( find_option("unified",0,0)!=0 ) diffFlags &= ~DIFF_SIDEBYSIDE;
2789 if( find_option("webpage",0,0)!=0 ){
2790 diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO;
2791 }
2792 if( find_option("browser","b",0)!=0 ){
2793 diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO|DIFF_BROWSER;
2794 }
2795 if( find_option("by",0,0)!=0 ){
2796 diffFlags |= DIFF_HTML|DIFF_WEBPAGE|DIFF_LINENO|DIFF_BROWSER
2797 |DIFF_SIDEBYSIDE;
2798 }
2799 if( find_option("json",0,0)!=0 ){
2800 diffFlags |= DIFF_JSON;
2801 }
2802 if( find_option("tcl",0,0)!=0 ){
2803 diffFlags |= DIFF_TCL;
2804 }
2805
2806 /* Undocumented and unsupported flags used for development
2807 ** debugging and analysis: */
2808 if( find_option("debug",0,0)!=0 ) diffFlags |= DIFF_DEBUG;
2809 if( find_option("raw",0,0)!=0 ) diffFlags |= DIFF_RAW;
2810 }
 
2811 if( (z = find_option("context","c",1))!=0 && (f = atoi(z))>=0 ){
2812 if( f > DIFF_CONTEXT_MASK ) f = DIFF_CONTEXT_MASK;
2813 diffFlags |= f + DIFF_CONTEXT_EX;
2814 }
2815 if( (z = find_option("width","W",1))!=0 && (f = atoi(z))>0 ){
2816 f *= DIFF_CONTEXT_MASK+1;
2817 if( f > DIFF_WIDTH_MASK ) f = DIFF_CONTEXT_MASK;
2818 diffFlags |= f;
2819 }
 
2820 if( find_option("linenum","n",0)!=0 ) diffFlags |= DIFF_LINENO;
2821 if( find_option("noopt",0,0)!=0 ) diffFlags |= DIFF_NOOPT;
2822 if( find_option("numstat",0,0)!=0 ) diffFlags |= DIFF_NUMSTAT;
2823 if( find_option("invert",0,0)!=0 ) diffFlags |= DIFF_INVERT;
2824 if( find_option("brief",0,0)!=0 ) diffFlags |= DIFF_BRIEF;
2825 if( find_option("internal","i",0)==0
2826 && (diffFlags & (DIFF_HTML|DIFF_TCL|DIFF_DEBUG|DIFF_JSON))==0
2827 ){
2828 pCfg->zDiffCmd = diff_command_external(isGDiff);
2829 if( pCfg->zDiffCmd ){
2830 const char *zDiffBinary;
2831 pCfg->zBinGlob = diff_get_binary_glob();
2832 zDiffBinary = find_option("diff-binary", 0, 1);
2833 if( zDiffBinary ){
2834 if( is_truth(zDiffBinary) ) diffFlags |= DIFF_INCBINARY;
2835 }else if( db_get_boolean("diff-binary", 1) ){
2836 diffFlags |= DIFF_INCBINARY;
2837 }
2838 }
2839 }
2840 if( find_option("verbose","v",0)!=0 ) diffFlags |= DIFF_VERBOSE;
2841
 
 
 
 
2842 pCfg->diffFlags = diffFlags;
2843 }
2844
2845 /*
2846 ** COMMAND: test-diff
@@ -2850,11 +2870,11 @@
2870 diff_tk("xdiff", 2);
2871 return;
2872 }
2873 find_option("i",0,0);
2874 find_option("v",0,0);
2875 diff_options(&DCfg, 0, 0);
2876 zRe = find_option("regexp","e",1);
2877 if( zRe ){
2878 const char *zErr = re_compile(&DCfg.pRe, zRe, 0);
2879 if( zErr ) fossil_fatal("regex error: %s", zErr);
2880 }
2881
+23 -92
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -412,21 +412,17 @@
412412
** for file names to treat as binary. If fIncludeBinary is zero, these files
413413
** will be skipped in addition to files that may contain binary content.
414414
*/
415415
void diff_file(
416416
Blob *pFile1, /* In memory content to compare from */
417
- int isBin1, /* Does the 'from' content appear to be binary */
418417
const char *zFile2, /* On disk content to compare to */
419418
const char *zName, /* Display name of the file */
420
- const char *zDiffCmd, /* Command for comparison */
421
- const char *zBinGlob, /* Treat file names matching this as binary */
422
- int fIncludeBinary, /* Include binary files for external diff */
423419
DiffConfig *pCfg, /* Flags to control the diff */
424420
int fSwapDiff, /* Diff from Zfile2 to Pfile1 */
425421
Blob *diffBlob /* Blob to store diff output */
426422
){
427
- if( zDiffCmd==0 ){
423
+ if( pCfg->zDiffCmd==0 ){
428424
Blob out; /* Diff output text */
429425
Blob file2; /* Content of zFile2 */
430426
const char *zName2; /* Name of zFile2 for display */
431427
432428
/* Read content of zFile2 into memory */
@@ -473,18 +469,18 @@
473469
blob_reset(&file2);
474470
}else{
475471
Blob nameFile1; /* Name of temporary file to old pFile1 content */
476472
Blob cmd; /* Text of command to run */
477473
478
- if( !fIncludeBinary ){
474
+ if( (pCfg->diffFlags & DIFF_INCBINARY)==0 ){
479475
Blob file2;
480
- if( isBin1 ){
476
+ if( looks_like_binary(pFile1) ){
481477
fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
482478
return;
483479
}
484
- if( zBinGlob ){
485
- Glob *pBinary = glob_create(zBinGlob);
480
+ if( pCfg->zBinGlob ){
481
+ Glob *pBinary = glob_create(pCfg->zBinGlob);
486482
if( glob_match(pBinary, zName) ){
487483
fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
488484
glob_free(pBinary);
489485
return;
490486
}
@@ -507,11 +503,11 @@
507503
file_tempname(&nameFile1, zFile2, "orig");
508504
blob_write_to_file(pFile1, blob_str(&nameFile1));
509505
510506
/* Construct the external diff command */
511507
blob_zero(&cmd);
512
- blob_append(&cmd, zDiffCmd, -1);
508
+ blob_append(&cmd, pCfg->zDiffCmd, -1);
513509
if( fSwapDiff ){
514510
blob_append_escaped_arg(&cmd, zFile2, 1);
515511
blob_append_escaped_arg(&cmd, blob_str(&nameFile1), 1);
516512
}else{
517513
blob_append_escaped_arg(&cmd, blob_str(&nameFile1), 1);
@@ -542,20 +538,15 @@
542538
** will be skipped in addition to files that may contain binary content.
543539
*/
544540
void diff_file_mem(
545541
Blob *pFile1, /* In memory content to compare from */
546542
Blob *pFile2, /* In memory content to compare to */
547
- int isBin1, /* Does the 'from' content appear to be binary */
548
- int isBin2, /* Does the 'to' content appear to be binary */
549543
const char *zName, /* Display name of the file */
550
- const char *zDiffCmd, /* Command for comparison */
551
- const char *zBinGlob, /* Treat file names matching this as binary */
552
- int fIncludeBinary, /* Include binary files for external diff */
553544
DiffConfig *pCfg /* Diff flags */
554545
){
555546
if( pCfg->diffFlags & DIFF_BRIEF ) return;
556
- if( zDiffCmd==0 ){
547
+ if( pCfg->zDiffCmd==0 ){
557548
Blob out; /* Diff output text */
558549
559550
blob_zero(&out);
560551
text_diff(pFile1, pFile2, &out, pCfg);
561552
if( pCfg->diffFlags & DIFF_NUMSTAT ){
@@ -570,17 +561,17 @@
570561
}else{
571562
Blob cmd;
572563
Blob temp1;
573564
Blob temp2;
574565
575
- if( !fIncludeBinary ){
576
- if( isBin1 || isBin2 ){
566
+ if( (pCfg->diffFlags & DIFF_INCBINARY)==0 ){
567
+ if( looks_like_binary(pFile1) || looks_like_binary(pFile2) ){
577568
fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
578569
return;
579570
}
580
- if( zBinGlob ){
581
- Glob *pBinary = glob_create(zBinGlob);
571
+ if( pCfg->zBinGlob ){
572
+ Glob *pBinary = glob_create(pCfg->zBinGlob);
582573
if( glob_match(pBinary, zName) ){
583574
fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
584575
glob_free(pBinary);
585576
return;
586577
}
@@ -594,11 +585,11 @@
594585
blob_write_to_file(pFile1, blob_str(&temp1));
595586
blob_write_to_file(pFile2, blob_str(&temp2));
596587
597588
/* Construct the external diff command */
598589
blob_zero(&cmd);
599
- blob_append(&cmd, zDiffCmd, -1);
590
+ blob_append(&cmd, pCfg->zDiffCmd, -1);
600591
blob_append_escaped_arg(&cmd, blob_str(&temp1), 1);
601592
blob_append_escaped_arg(&cmd, blob_str(&temp2), 1);
602593
603594
/* Run the external diff command */
604595
fossil_system(blob_str(&cmd));
@@ -625,13 +616,10 @@
625616
** for file names to treat as binary. If fIncludeBinary is zero, these files
626617
** will be skipped in addition to files that may contain binary content.
627618
*/
628619
void diff_against_disk(
629620
const char *zFrom, /* Version to difference from */
630
- const char *zDiffCmd, /* Use this diff command. NULL for built-in */
631
- const char *zBinGlob, /* Treat file names matching this as binary */
632
- int fIncludeBinary, /* Treat file names matching this as binary */
633621
DiffConfig *pCfg, /* Flags controlling diff output */
634622
FileDirList *pFileDir, /* Which files to diff */
635623
Blob *diffBlob /* Blob to output diff instead of stdout */
636624
){
637625
int vid;
@@ -723,11 +711,10 @@
723711
srcid = 0;
724712
if( !asNewFile ){ showDiff = 0; }
725713
}
726714
if( showDiff ){
727715
Blob content;
728
- int isBin;
729716
if( !isLink != !file_islink(zFullName) ){
730717
diff_print_index(zPathname, pCfg, 0);
731718
diff_print_filenames(zPathname, zPathname, pCfg, 0);
732719
fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK);
733720
continue;
@@ -735,14 +722,12 @@
735722
if( srcid>0 ){
736723
content_get(srcid, &content);
737724
}else{
738725
blob_zero(&content);
739726
}
740
- isBin = fIncludeBinary ? 0 : looks_like_binary(&content);
741727
diff_print_index(zPathname, pCfg, diffBlob);
742
- diff_file(&content, isBin, zFullName, zPathname, zDiffCmd,
743
- zBinGlob, fIncludeBinary, pCfg, 0, diffBlob);
728
+ diff_file(&content, zFullName, zPathname, pCfg, 0, diffBlob);
744729
blob_reset(&content);
745730
}
746731
blob_reset(&fname);
747732
}
748733
db_finalize(&q);
@@ -758,13 +743,10 @@
758743
** When using an external diff program, zBinGlob contains the GLOB patterns
759744
** for file names to treat as binary. If fIncludeBinary is zero, these files
760745
** will be skipped in addition to files that may contain binary content.
761746
*/
762747
static void diff_against_undo(
763
- const char *zDiffCmd, /* Use this diff command. NULL for built-in */
764
- const char *zBinGlob, /* Treat file names matching this as binary */
765
- int fIncludeBinary, /* Treat file names matching this as binary */
766748
DiffConfig *pCfg, /* Flags controlling diff output */
767749
FileDirList *pFileDir /* List of files and directories to diff */
768750
){
769751
Stmt q;
770752
Blob content;
@@ -774,12 +756,11 @@
774756
char *zFullName;
775757
const char *zFile = (const char*)db_column_text(&q, 0);
776758
if( !file_dir_match(pFileDir, zFile) ) continue;
777759
zFullName = mprintf("%s%s", g.zLocalRoot, zFile);
778760
db_column_blob(&q, 1, &content);
779
- diff_file(&content, 0, zFullName, zFile,
780
- zDiffCmd, zBinGlob, fIncludeBinary, pCfg, 0, 0);
761
+ diff_file(&content, zFullName, zFile, pCfg, 0, 0);
781762
fossil_free(zFullName);
782763
blob_reset(&content);
783764
}
784765
db_finalize(&q);
785766
}
@@ -796,17 +777,13 @@
796777
** will be skipped in addition to files that may contain binary content.
797778
*/
798779
static void diff_manifest_entry(
799780
struct ManifestFile *pFrom,
800781
struct ManifestFile *pTo,
801
- const char *zDiffCmd,
802
- const char *zBinGlob,
803
- int fIncludeBinary,
804782
DiffConfig *pCfg
805783
){
806784
Blob f1, f2;
807
- int isBin1, isBin2;
808785
int rid;
809786
const char *zName;
810787
if( pFrom ){
811788
zName = pFrom->zName;
812789
}else if( pTo ){
@@ -826,14 +803,11 @@
826803
rid = uuid_to_rid(pTo->zUuid, 0);
827804
content_get(rid, &f2);
828805
}else{
829806
blob_zero(&f2);
830807
}
831
- isBin1 = fIncludeBinary ? 0 : looks_like_binary(&f1);
832
- isBin2 = fIncludeBinary ? 0 : looks_like_binary(&f2);
833
- diff_file_mem(&f1, &f2, isBin1, isBin2, zName, zDiffCmd,
834
- zBinGlob, fIncludeBinary, pCfg);
808
+ diff_file_mem(&f1, &f2, zName, pCfg);
835809
blob_reset(&f1);
836810
blob_reset(&f2);
837811
}
838812
839813
/*
@@ -847,13 +821,10 @@
847821
** will be skipped in addition to files that may contain binary content.
848822
*/
849823
static void diff_two_versions(
850824
const char *zFrom,
851825
const char *zTo,
852
- const char *zDiffCmd,
853
- const char *zBinGlob,
854
- int fIncludeBinary,
855826
DiffConfig *pCfg,
856827
FileDirList *pFileDir
857828
){
858829
Manifest *pFrom, *pTo;
859830
ManifestFile *pFromFile, *pToFile;
@@ -879,12 +850,11 @@
879850
if( file_dir_match(pFileDir, pFromFile->zName) ){
880851
if( (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_HTML))==0 ){
881852
fossil_print("DELETED %s\n", pFromFile->zName);
882853
}
883854
if( asNewFlag ){
884
- diff_manifest_entry(pFromFile, 0, zDiffCmd, zBinGlob,
885
- fIncludeBinary, pCfg);
855
+ diff_manifest_entry(pFromFile, 0, pCfg);
886856
}
887857
}
888858
pFromFile = manifest_file_next(pFrom,0);
889859
}else if( cmp>0 ){
890860
if( file_dir_match(pFileDir, pToFile->zName) ){
@@ -891,12 +861,11 @@
891861
if( (pCfg->diffFlags &
892862
(DIFF_NUMSTAT|DIFF_HTML|DIFF_TCL|DIFF_JSON))==0 ){
893863
fossil_print("ADDED %s\n", pToFile->zName);
894864
}
895865
if( asNewFlag ){
896
- diff_manifest_entry(0, pToFile, zDiffCmd, zBinGlob,
897
- fIncludeBinary, pCfg);
866
+ diff_manifest_entry(0, pToFile, pCfg);
898867
}
899868
}
900869
pToFile = manifest_file_next(pTo,0);
901870
}else if( fossil_strcmp(pFromFile->zUuid, pToFile->zUuid)==0 ){
902871
/* No changes */
@@ -906,12 +875,11 @@
906875
}else{
907876
if( file_dir_match(pFileDir, pToFile->zName) ){
908877
if( pCfg->diffFlags & DIFF_BRIEF ){
909878
fossil_print("CHANGED %s\n", pFromFile->zName);
910879
}else{
911
- diff_manifest_entry(pFromFile, pToFile, zDiffCmd, zBinGlob,
912
- fIncludeBinary, pCfg);
880
+ diff_manifest_entry(pFromFile, pToFile, pCfg);
913881
}
914882
}
915883
pFromFile = manifest_file_next(pFrom,0);
916884
pToFile = manifest_file_next(pTo,0);
917885
}
@@ -1011,25 +979,10 @@
1011979
fossil_free(zCmd);
1012980
}
1013981
blob_reset(&script);
1014982
}
1015983
1016
-/*
1017
-** Returns non-zero if files that may be binary should be used with external
1018
-** diff programs.
1019
-*/
1020
-int diff_include_binary_files(void){
1021
- const char* zArgIncludeBinary = find_option("diff-binary", 0, 1);
1022
-
1023
- /* Command line argument have priority on settings */
1024
- if( zArgIncludeBinary ){
1025
- return is_truth(zArgIncludeBinary);
1026
- }else{
1027
- return db_get_boolean("diff-binary", 1);
1028
- }
1029
-}
1030
-
1031984
/*
1032985
** Returns the GLOB pattern for file names that should be treated as binary
1033986
** by the diff subsystem, if any.
1034987
*/
1035988
const char *diff_get_binary_glob(void){
@@ -1117,40 +1070,28 @@
11171070
** -W|--width N Width of lines in side-by-side diff
11181071
** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace
11191072
*/
11201073
void diff_cmd(void){
11211074
int isGDiff; /* True for gdiff. False for normal diff */
1122
- int isInternDiff; /* True for internal diff */
1123
- int verboseFlag; /* True if -v or --verbose flag is used */
11241075
const char *zFrom; /* Source version number */
11251076
const char *zTo; /* Target version number */
11261077
const char *zCheckin; /* Check-in version number */
11271078
const char *zBranch; /* Branch to diff */
1128
- const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
1129
- const char *zBinGlob = 0; /* Treat file names matching this as binary */
1130
- int fIncludeBinary = 0; /* Include binary files for external diff */
11311079
int againstUndo = 0; /* Diff against files in the undo buffer */
11321080
FileDirList *pFileDir = 0; /* Restrict the diff to these files */
11331081
DiffConfig DCfg; /* Diff configuration object */
11341082
11351083
if( find_option("tk",0,0)!=0 || has_option("tclsh") ){
11361084
diff_tk("diff", 2);
11371085
return;
11381086
}
11391087
isGDiff = g.argv[1][0]=='g';
1140
- isInternDiff = find_option("internal","i",0)!=0;
11411088
zFrom = find_option("from", "r", 1);
11421089
zTo = find_option("to", 0, 1);
11431090
zCheckin = find_option("checkin", 0, 1);
11441091
zBranch = find_option("branch", 0, 1);
11451092
againstUndo = find_option("undo",0,0)!=0;
1146
- diff_options(&DCfg, isGDiff);
1147
- verboseFlag = find_option("verbose","v",0)!=0;
1148
- if( !verboseFlag ){
1149
- verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */
1150
- }
1151
- if( verboseFlag ) DCfg.diffFlags |= DIFF_VERBOSE;
11521093
if( againstUndo && ( zFrom!=0 || zTo!=0 || zCheckin!=0 || zBranch!=0) ){
11531094
fossil_fatal("cannot use --undo together with --from, --to, --checkin,"
11541095
" or --branch");
11551096
}
11561097
if( zBranch ){
@@ -1169,18 +1110,11 @@
11691110
}else if( zFrom==0 ){
11701111
fossil_fatal("must use --from if --to is present");
11711112
}else{
11721113
db_find_and_open_repository(0, 0);
11731114
}
1174
- if( !isInternDiff
1175
- && (DCfg.diffFlags & DIFF_HTML)==0 /* External diff can't generate HTML */
1176
- ){
1177
- zDiffCmd = find_option("command", 0, 1);
1178
- if( zDiffCmd==0 ) zDiffCmd = diff_command_external(isGDiff);
1179
- }
1180
- zBinGlob = diff_get_binary_glob();
1181
- fIncludeBinary = diff_include_binary_files();
1115
+ diff_options(&DCfg, isGDiff, 0);
11821116
determine_exec_relative_option(1);
11831117
verify_all_options();
11841118
if( g.argc>=3 ){
11851119
int i;
11861120
Blob fname;
@@ -1214,18 +1148,15 @@
12141148
if( againstUndo ){
12151149
if( db_lget_int("undo_available",0)==0 ){
12161150
fossil_print("No undo or redo is available\n");
12171151
return;
12181152
}
1219
- diff_against_undo(zDiffCmd, zBinGlob, fIncludeBinary,
1220
- &DCfg, pFileDir);
1153
+ diff_against_undo(&DCfg, pFileDir);
12211154
}else if( zTo==0 ){
1222
- diff_against_disk(zFrom, zDiffCmd, zBinGlob, fIncludeBinary,
1223
- &DCfg, pFileDir, 0);
1155
+ diff_against_disk(zFrom, &DCfg, pFileDir, 0);
12241156
}else{
1225
- diff_two_versions(zFrom, zTo, zDiffCmd, zBinGlob, fIncludeBinary,
1226
- &DCfg, pFileDir);
1157
+ diff_two_versions(zFrom, zTo, &DCfg, pFileDir);
12271158
}
12281159
if( pFileDir ){
12291160
int i;
12301161
for(i=0; pFileDir[i].zName; i++){
12311162
if( pFileDir[i].nUsed==0
@@ -1259,7 +1190,7 @@
12591190
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
12601191
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
12611192
12621193
cgi_set_content_type("text/plain");
12631194
diff_config_init(&DCfg, DIFF_VERBOSE);
1264
- diff_two_versions(zFrom, zTo, 0, 0, 0, &DCfg, 0);
1195
+ diff_two_versions(zFrom, zTo, &DCfg, 0);
12651196
}
12661197
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -412,21 +412,17 @@
412 ** for file names to treat as binary. If fIncludeBinary is zero, these files
413 ** will be skipped in addition to files that may contain binary content.
414 */
415 void diff_file(
416 Blob *pFile1, /* In memory content to compare from */
417 int isBin1, /* Does the 'from' content appear to be binary */
418 const char *zFile2, /* On disk content to compare to */
419 const char *zName, /* Display name of the file */
420 const char *zDiffCmd, /* Command for comparison */
421 const char *zBinGlob, /* Treat file names matching this as binary */
422 int fIncludeBinary, /* Include binary files for external diff */
423 DiffConfig *pCfg, /* Flags to control the diff */
424 int fSwapDiff, /* Diff from Zfile2 to Pfile1 */
425 Blob *diffBlob /* Blob to store diff output */
426 ){
427 if( zDiffCmd==0 ){
428 Blob out; /* Diff output text */
429 Blob file2; /* Content of zFile2 */
430 const char *zName2; /* Name of zFile2 for display */
431
432 /* Read content of zFile2 into memory */
@@ -473,18 +469,18 @@
473 blob_reset(&file2);
474 }else{
475 Blob nameFile1; /* Name of temporary file to old pFile1 content */
476 Blob cmd; /* Text of command to run */
477
478 if( !fIncludeBinary ){
479 Blob file2;
480 if( isBin1 ){
481 fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
482 return;
483 }
484 if( zBinGlob ){
485 Glob *pBinary = glob_create(zBinGlob);
486 if( glob_match(pBinary, zName) ){
487 fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
488 glob_free(pBinary);
489 return;
490 }
@@ -507,11 +503,11 @@
507 file_tempname(&nameFile1, zFile2, "orig");
508 blob_write_to_file(pFile1, blob_str(&nameFile1));
509
510 /* Construct the external diff command */
511 blob_zero(&cmd);
512 blob_append(&cmd, zDiffCmd, -1);
513 if( fSwapDiff ){
514 blob_append_escaped_arg(&cmd, zFile2, 1);
515 blob_append_escaped_arg(&cmd, blob_str(&nameFile1), 1);
516 }else{
517 blob_append_escaped_arg(&cmd, blob_str(&nameFile1), 1);
@@ -542,20 +538,15 @@
542 ** will be skipped in addition to files that may contain binary content.
543 */
544 void diff_file_mem(
545 Blob *pFile1, /* In memory content to compare from */
546 Blob *pFile2, /* In memory content to compare to */
547 int isBin1, /* Does the 'from' content appear to be binary */
548 int isBin2, /* Does the 'to' content appear to be binary */
549 const char *zName, /* Display name of the file */
550 const char *zDiffCmd, /* Command for comparison */
551 const char *zBinGlob, /* Treat file names matching this as binary */
552 int fIncludeBinary, /* Include binary files for external diff */
553 DiffConfig *pCfg /* Diff flags */
554 ){
555 if( pCfg->diffFlags & DIFF_BRIEF ) return;
556 if( zDiffCmd==0 ){
557 Blob out; /* Diff output text */
558
559 blob_zero(&out);
560 text_diff(pFile1, pFile2, &out, pCfg);
561 if( pCfg->diffFlags & DIFF_NUMSTAT ){
@@ -570,17 +561,17 @@
570 }else{
571 Blob cmd;
572 Blob temp1;
573 Blob temp2;
574
575 if( !fIncludeBinary ){
576 if( isBin1 || isBin2 ){
577 fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
578 return;
579 }
580 if( zBinGlob ){
581 Glob *pBinary = glob_create(zBinGlob);
582 if( glob_match(pBinary, zName) ){
583 fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
584 glob_free(pBinary);
585 return;
586 }
@@ -594,11 +585,11 @@
594 blob_write_to_file(pFile1, blob_str(&temp1));
595 blob_write_to_file(pFile2, blob_str(&temp2));
596
597 /* Construct the external diff command */
598 blob_zero(&cmd);
599 blob_append(&cmd, zDiffCmd, -1);
600 blob_append_escaped_arg(&cmd, blob_str(&temp1), 1);
601 blob_append_escaped_arg(&cmd, blob_str(&temp2), 1);
602
603 /* Run the external diff command */
604 fossil_system(blob_str(&cmd));
@@ -625,13 +616,10 @@
625 ** for file names to treat as binary. If fIncludeBinary is zero, these files
626 ** will be skipped in addition to files that may contain binary content.
627 */
628 void diff_against_disk(
629 const char *zFrom, /* Version to difference from */
630 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
631 const char *zBinGlob, /* Treat file names matching this as binary */
632 int fIncludeBinary, /* Treat file names matching this as binary */
633 DiffConfig *pCfg, /* Flags controlling diff output */
634 FileDirList *pFileDir, /* Which files to diff */
635 Blob *diffBlob /* Blob to output diff instead of stdout */
636 ){
637 int vid;
@@ -723,11 +711,10 @@
723 srcid = 0;
724 if( !asNewFile ){ showDiff = 0; }
725 }
726 if( showDiff ){
727 Blob content;
728 int isBin;
729 if( !isLink != !file_islink(zFullName) ){
730 diff_print_index(zPathname, pCfg, 0);
731 diff_print_filenames(zPathname, zPathname, pCfg, 0);
732 fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK);
733 continue;
@@ -735,14 +722,12 @@
735 if( srcid>0 ){
736 content_get(srcid, &content);
737 }else{
738 blob_zero(&content);
739 }
740 isBin = fIncludeBinary ? 0 : looks_like_binary(&content);
741 diff_print_index(zPathname, pCfg, diffBlob);
742 diff_file(&content, isBin, zFullName, zPathname, zDiffCmd,
743 zBinGlob, fIncludeBinary, pCfg, 0, diffBlob);
744 blob_reset(&content);
745 }
746 blob_reset(&fname);
747 }
748 db_finalize(&q);
@@ -758,13 +743,10 @@
758 ** When using an external diff program, zBinGlob contains the GLOB patterns
759 ** for file names to treat as binary. If fIncludeBinary is zero, these files
760 ** will be skipped in addition to files that may contain binary content.
761 */
762 static void diff_against_undo(
763 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
764 const char *zBinGlob, /* Treat file names matching this as binary */
765 int fIncludeBinary, /* Treat file names matching this as binary */
766 DiffConfig *pCfg, /* Flags controlling diff output */
767 FileDirList *pFileDir /* List of files and directories to diff */
768 ){
769 Stmt q;
770 Blob content;
@@ -774,12 +756,11 @@
774 char *zFullName;
775 const char *zFile = (const char*)db_column_text(&q, 0);
776 if( !file_dir_match(pFileDir, zFile) ) continue;
777 zFullName = mprintf("%s%s", g.zLocalRoot, zFile);
778 db_column_blob(&q, 1, &content);
779 diff_file(&content, 0, zFullName, zFile,
780 zDiffCmd, zBinGlob, fIncludeBinary, pCfg, 0, 0);
781 fossil_free(zFullName);
782 blob_reset(&content);
783 }
784 db_finalize(&q);
785 }
@@ -796,17 +777,13 @@
796 ** will be skipped in addition to files that may contain binary content.
797 */
798 static void diff_manifest_entry(
799 struct ManifestFile *pFrom,
800 struct ManifestFile *pTo,
801 const char *zDiffCmd,
802 const char *zBinGlob,
803 int fIncludeBinary,
804 DiffConfig *pCfg
805 ){
806 Blob f1, f2;
807 int isBin1, isBin2;
808 int rid;
809 const char *zName;
810 if( pFrom ){
811 zName = pFrom->zName;
812 }else if( pTo ){
@@ -826,14 +803,11 @@
826 rid = uuid_to_rid(pTo->zUuid, 0);
827 content_get(rid, &f2);
828 }else{
829 blob_zero(&f2);
830 }
831 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&f1);
832 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&f2);
833 diff_file_mem(&f1, &f2, isBin1, isBin2, zName, zDiffCmd,
834 zBinGlob, fIncludeBinary, pCfg);
835 blob_reset(&f1);
836 blob_reset(&f2);
837 }
838
839 /*
@@ -847,13 +821,10 @@
847 ** will be skipped in addition to files that may contain binary content.
848 */
849 static void diff_two_versions(
850 const char *zFrom,
851 const char *zTo,
852 const char *zDiffCmd,
853 const char *zBinGlob,
854 int fIncludeBinary,
855 DiffConfig *pCfg,
856 FileDirList *pFileDir
857 ){
858 Manifest *pFrom, *pTo;
859 ManifestFile *pFromFile, *pToFile;
@@ -879,12 +850,11 @@
879 if( file_dir_match(pFileDir, pFromFile->zName) ){
880 if( (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_HTML))==0 ){
881 fossil_print("DELETED %s\n", pFromFile->zName);
882 }
883 if( asNewFlag ){
884 diff_manifest_entry(pFromFile, 0, zDiffCmd, zBinGlob,
885 fIncludeBinary, pCfg);
886 }
887 }
888 pFromFile = manifest_file_next(pFrom,0);
889 }else if( cmp>0 ){
890 if( file_dir_match(pFileDir, pToFile->zName) ){
@@ -891,12 +861,11 @@
891 if( (pCfg->diffFlags &
892 (DIFF_NUMSTAT|DIFF_HTML|DIFF_TCL|DIFF_JSON))==0 ){
893 fossil_print("ADDED %s\n", pToFile->zName);
894 }
895 if( asNewFlag ){
896 diff_manifest_entry(0, pToFile, zDiffCmd, zBinGlob,
897 fIncludeBinary, pCfg);
898 }
899 }
900 pToFile = manifest_file_next(pTo,0);
901 }else if( fossil_strcmp(pFromFile->zUuid, pToFile->zUuid)==0 ){
902 /* No changes */
@@ -906,12 +875,11 @@
906 }else{
907 if( file_dir_match(pFileDir, pToFile->zName) ){
908 if( pCfg->diffFlags & DIFF_BRIEF ){
909 fossil_print("CHANGED %s\n", pFromFile->zName);
910 }else{
911 diff_manifest_entry(pFromFile, pToFile, zDiffCmd, zBinGlob,
912 fIncludeBinary, pCfg);
913 }
914 }
915 pFromFile = manifest_file_next(pFrom,0);
916 pToFile = manifest_file_next(pTo,0);
917 }
@@ -1011,25 +979,10 @@
1011 fossil_free(zCmd);
1012 }
1013 blob_reset(&script);
1014 }
1015
1016 /*
1017 ** Returns non-zero if files that may be binary should be used with external
1018 ** diff programs.
1019 */
1020 int diff_include_binary_files(void){
1021 const char* zArgIncludeBinary = find_option("diff-binary", 0, 1);
1022
1023 /* Command line argument have priority on settings */
1024 if( zArgIncludeBinary ){
1025 return is_truth(zArgIncludeBinary);
1026 }else{
1027 return db_get_boolean("diff-binary", 1);
1028 }
1029 }
1030
1031 /*
1032 ** Returns the GLOB pattern for file names that should be treated as binary
1033 ** by the diff subsystem, if any.
1034 */
1035 const char *diff_get_binary_glob(void){
@@ -1117,40 +1070,28 @@
1117 ** -W|--width N Width of lines in side-by-side diff
1118 ** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace
1119 */
1120 void diff_cmd(void){
1121 int isGDiff; /* True for gdiff. False for normal diff */
1122 int isInternDiff; /* True for internal diff */
1123 int verboseFlag; /* True if -v or --verbose flag is used */
1124 const char *zFrom; /* Source version number */
1125 const char *zTo; /* Target version number */
1126 const char *zCheckin; /* Check-in version number */
1127 const char *zBranch; /* Branch to diff */
1128 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
1129 const char *zBinGlob = 0; /* Treat file names matching this as binary */
1130 int fIncludeBinary = 0; /* Include binary files for external diff */
1131 int againstUndo = 0; /* Diff against files in the undo buffer */
1132 FileDirList *pFileDir = 0; /* Restrict the diff to these files */
1133 DiffConfig DCfg; /* Diff configuration object */
1134
1135 if( find_option("tk",0,0)!=0 || has_option("tclsh") ){
1136 diff_tk("diff", 2);
1137 return;
1138 }
1139 isGDiff = g.argv[1][0]=='g';
1140 isInternDiff = find_option("internal","i",0)!=0;
1141 zFrom = find_option("from", "r", 1);
1142 zTo = find_option("to", 0, 1);
1143 zCheckin = find_option("checkin", 0, 1);
1144 zBranch = find_option("branch", 0, 1);
1145 againstUndo = find_option("undo",0,0)!=0;
1146 diff_options(&DCfg, isGDiff);
1147 verboseFlag = find_option("verbose","v",0)!=0;
1148 if( !verboseFlag ){
1149 verboseFlag = find_option("new-file","N",0)!=0; /* deprecated */
1150 }
1151 if( verboseFlag ) DCfg.diffFlags |= DIFF_VERBOSE;
1152 if( againstUndo && ( zFrom!=0 || zTo!=0 || zCheckin!=0 || zBranch!=0) ){
1153 fossil_fatal("cannot use --undo together with --from, --to, --checkin,"
1154 " or --branch");
1155 }
1156 if( zBranch ){
@@ -1169,18 +1110,11 @@
1169 }else if( zFrom==0 ){
1170 fossil_fatal("must use --from if --to is present");
1171 }else{
1172 db_find_and_open_repository(0, 0);
1173 }
1174 if( !isInternDiff
1175 && (DCfg.diffFlags & DIFF_HTML)==0 /* External diff can't generate HTML */
1176 ){
1177 zDiffCmd = find_option("command", 0, 1);
1178 if( zDiffCmd==0 ) zDiffCmd = diff_command_external(isGDiff);
1179 }
1180 zBinGlob = diff_get_binary_glob();
1181 fIncludeBinary = diff_include_binary_files();
1182 determine_exec_relative_option(1);
1183 verify_all_options();
1184 if( g.argc>=3 ){
1185 int i;
1186 Blob fname;
@@ -1214,18 +1148,15 @@
1214 if( againstUndo ){
1215 if( db_lget_int("undo_available",0)==0 ){
1216 fossil_print("No undo or redo is available\n");
1217 return;
1218 }
1219 diff_against_undo(zDiffCmd, zBinGlob, fIncludeBinary,
1220 &DCfg, pFileDir);
1221 }else if( zTo==0 ){
1222 diff_against_disk(zFrom, zDiffCmd, zBinGlob, fIncludeBinary,
1223 &DCfg, pFileDir, 0);
1224 }else{
1225 diff_two_versions(zFrom, zTo, zDiffCmd, zBinGlob, fIncludeBinary,
1226 &DCfg, pFileDir);
1227 }
1228 if( pFileDir ){
1229 int i;
1230 for(i=0; pFileDir[i].zName; i++){
1231 if( pFileDir[i].nUsed==0
@@ -1259,7 +1190,7 @@
1259 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1260 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
1261
1262 cgi_set_content_type("text/plain");
1263 diff_config_init(&DCfg, DIFF_VERBOSE);
1264 diff_two_versions(zFrom, zTo, 0, 0, 0, &DCfg, 0);
1265 }
1266
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -412,21 +412,17 @@
412 ** for file names to treat as binary. If fIncludeBinary is zero, these files
413 ** will be skipped in addition to files that may contain binary content.
414 */
415 void diff_file(
416 Blob *pFile1, /* In memory content to compare from */
 
417 const char *zFile2, /* On disk content to compare to */
418 const char *zName, /* Display name of the file */
 
 
 
419 DiffConfig *pCfg, /* Flags to control the diff */
420 int fSwapDiff, /* Diff from Zfile2 to Pfile1 */
421 Blob *diffBlob /* Blob to store diff output */
422 ){
423 if( pCfg->zDiffCmd==0 ){
424 Blob out; /* Diff output text */
425 Blob file2; /* Content of zFile2 */
426 const char *zName2; /* Name of zFile2 for display */
427
428 /* Read content of zFile2 into memory */
@@ -473,18 +469,18 @@
469 blob_reset(&file2);
470 }else{
471 Blob nameFile1; /* Name of temporary file to old pFile1 content */
472 Blob cmd; /* Text of command to run */
473
474 if( (pCfg->diffFlags & DIFF_INCBINARY)==0 ){
475 Blob file2;
476 if( looks_like_binary(pFile1) ){
477 fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
478 return;
479 }
480 if( pCfg->zBinGlob ){
481 Glob *pBinary = glob_create(pCfg->zBinGlob);
482 if( glob_match(pBinary, zName) ){
483 fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
484 glob_free(pBinary);
485 return;
486 }
@@ -507,11 +503,11 @@
503 file_tempname(&nameFile1, zFile2, "orig");
504 blob_write_to_file(pFile1, blob_str(&nameFile1));
505
506 /* Construct the external diff command */
507 blob_zero(&cmd);
508 blob_append(&cmd, pCfg->zDiffCmd, -1);
509 if( fSwapDiff ){
510 blob_append_escaped_arg(&cmd, zFile2, 1);
511 blob_append_escaped_arg(&cmd, blob_str(&nameFile1), 1);
512 }else{
513 blob_append_escaped_arg(&cmd, blob_str(&nameFile1), 1);
@@ -542,20 +538,15 @@
538 ** will be skipped in addition to files that may contain binary content.
539 */
540 void diff_file_mem(
541 Blob *pFile1, /* In memory content to compare from */
542 Blob *pFile2, /* In memory content to compare to */
 
 
543 const char *zName, /* Display name of the file */
 
 
 
544 DiffConfig *pCfg /* Diff flags */
545 ){
546 if( pCfg->diffFlags & DIFF_BRIEF ) return;
547 if( pCfg->zDiffCmd==0 ){
548 Blob out; /* Diff output text */
549
550 blob_zero(&out);
551 text_diff(pFile1, pFile2, &out, pCfg);
552 if( pCfg->diffFlags & DIFF_NUMSTAT ){
@@ -570,17 +561,17 @@
561 }else{
562 Blob cmd;
563 Blob temp1;
564 Blob temp2;
565
566 if( (pCfg->diffFlags & DIFF_INCBINARY)==0 ){
567 if( looks_like_binary(pFile1) || looks_like_binary(pFile2) ){
568 fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
569 return;
570 }
571 if( pCfg->zBinGlob ){
572 Glob *pBinary = glob_create(pCfg->zBinGlob);
573 if( glob_match(pBinary, zName) ){
574 fossil_print("%s",DIFF_CANNOT_COMPUTE_BINARY);
575 glob_free(pBinary);
576 return;
577 }
@@ -594,11 +585,11 @@
585 blob_write_to_file(pFile1, blob_str(&temp1));
586 blob_write_to_file(pFile2, blob_str(&temp2));
587
588 /* Construct the external diff command */
589 blob_zero(&cmd);
590 blob_append(&cmd, pCfg->zDiffCmd, -1);
591 blob_append_escaped_arg(&cmd, blob_str(&temp1), 1);
592 blob_append_escaped_arg(&cmd, blob_str(&temp2), 1);
593
594 /* Run the external diff command */
595 fossil_system(blob_str(&cmd));
@@ -625,13 +616,10 @@
616 ** for file names to treat as binary. If fIncludeBinary is zero, these files
617 ** will be skipped in addition to files that may contain binary content.
618 */
619 void diff_against_disk(
620 const char *zFrom, /* Version to difference from */
 
 
 
621 DiffConfig *pCfg, /* Flags controlling diff output */
622 FileDirList *pFileDir, /* Which files to diff */
623 Blob *diffBlob /* Blob to output diff instead of stdout */
624 ){
625 int vid;
@@ -723,11 +711,10 @@
711 srcid = 0;
712 if( !asNewFile ){ showDiff = 0; }
713 }
714 if( showDiff ){
715 Blob content;
 
716 if( !isLink != !file_islink(zFullName) ){
717 diff_print_index(zPathname, pCfg, 0);
718 diff_print_filenames(zPathname, zPathname, pCfg, 0);
719 fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK);
720 continue;
@@ -735,14 +722,12 @@
722 if( srcid>0 ){
723 content_get(srcid, &content);
724 }else{
725 blob_zero(&content);
726 }
 
727 diff_print_index(zPathname, pCfg, diffBlob);
728 diff_file(&content, zFullName, zPathname, pCfg, 0, diffBlob);
 
729 blob_reset(&content);
730 }
731 blob_reset(&fname);
732 }
733 db_finalize(&q);
@@ -758,13 +743,10 @@
743 ** When using an external diff program, zBinGlob contains the GLOB patterns
744 ** for file names to treat as binary. If fIncludeBinary is zero, these files
745 ** will be skipped in addition to files that may contain binary content.
746 */
747 static void diff_against_undo(
 
 
 
748 DiffConfig *pCfg, /* Flags controlling diff output */
749 FileDirList *pFileDir /* List of files and directories to diff */
750 ){
751 Stmt q;
752 Blob content;
@@ -774,12 +756,11 @@
756 char *zFullName;
757 const char *zFile = (const char*)db_column_text(&q, 0);
758 if( !file_dir_match(pFileDir, zFile) ) continue;
759 zFullName = mprintf("%s%s", g.zLocalRoot, zFile);
760 db_column_blob(&q, 1, &content);
761 diff_file(&content, zFullName, zFile, pCfg, 0, 0);
 
762 fossil_free(zFullName);
763 blob_reset(&content);
764 }
765 db_finalize(&q);
766 }
@@ -796,17 +777,13 @@
777 ** will be skipped in addition to files that may contain binary content.
778 */
779 static void diff_manifest_entry(
780 struct ManifestFile *pFrom,
781 struct ManifestFile *pTo,
 
 
 
782 DiffConfig *pCfg
783 ){
784 Blob f1, f2;
 
785 int rid;
786 const char *zName;
787 if( pFrom ){
788 zName = pFrom->zName;
789 }else if( pTo ){
@@ -826,14 +803,11 @@
803 rid = uuid_to_rid(pTo->zUuid, 0);
804 content_get(rid, &f2);
805 }else{
806 blob_zero(&f2);
807 }
808 diff_file_mem(&f1, &f2, zName, pCfg);
 
 
 
809 blob_reset(&f1);
810 blob_reset(&f2);
811 }
812
813 /*
@@ -847,13 +821,10 @@
821 ** will be skipped in addition to files that may contain binary content.
822 */
823 static void diff_two_versions(
824 const char *zFrom,
825 const char *zTo,
 
 
 
826 DiffConfig *pCfg,
827 FileDirList *pFileDir
828 ){
829 Manifest *pFrom, *pTo;
830 ManifestFile *pFromFile, *pToFile;
@@ -879,12 +850,11 @@
850 if( file_dir_match(pFileDir, pFromFile->zName) ){
851 if( (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_HTML))==0 ){
852 fossil_print("DELETED %s\n", pFromFile->zName);
853 }
854 if( asNewFlag ){
855 diff_manifest_entry(pFromFile, 0, pCfg);
 
856 }
857 }
858 pFromFile = manifest_file_next(pFrom,0);
859 }else if( cmp>0 ){
860 if( file_dir_match(pFileDir, pToFile->zName) ){
@@ -891,12 +861,11 @@
861 if( (pCfg->diffFlags &
862 (DIFF_NUMSTAT|DIFF_HTML|DIFF_TCL|DIFF_JSON))==0 ){
863 fossil_print("ADDED %s\n", pToFile->zName);
864 }
865 if( asNewFlag ){
866 diff_manifest_entry(0, pToFile, pCfg);
 
867 }
868 }
869 pToFile = manifest_file_next(pTo,0);
870 }else if( fossil_strcmp(pFromFile->zUuid, pToFile->zUuid)==0 ){
871 /* No changes */
@@ -906,12 +875,11 @@
875 }else{
876 if( file_dir_match(pFileDir, pToFile->zName) ){
877 if( pCfg->diffFlags & DIFF_BRIEF ){
878 fossil_print("CHANGED %s\n", pFromFile->zName);
879 }else{
880 diff_manifest_entry(pFromFile, pToFile, pCfg);
 
881 }
882 }
883 pFromFile = manifest_file_next(pFrom,0);
884 pToFile = manifest_file_next(pTo,0);
885 }
@@ -1011,25 +979,10 @@
979 fossil_free(zCmd);
980 }
981 blob_reset(&script);
982 }
983
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
984 /*
985 ** Returns the GLOB pattern for file names that should be treated as binary
986 ** by the diff subsystem, if any.
987 */
988 const char *diff_get_binary_glob(void){
@@ -1117,40 +1070,28 @@
1070 ** -W|--width N Width of lines in side-by-side diff
1071 ** -Z|--ignore-trailing-space Ignore changes to end-of-line whitespace
1072 */
1073 void diff_cmd(void){
1074 int isGDiff; /* True for gdiff. False for normal diff */
 
 
1075 const char *zFrom; /* Source version number */
1076 const char *zTo; /* Target version number */
1077 const char *zCheckin; /* Check-in version number */
1078 const char *zBranch; /* Branch to diff */
 
 
 
1079 int againstUndo = 0; /* Diff against files in the undo buffer */
1080 FileDirList *pFileDir = 0; /* Restrict the diff to these files */
1081 DiffConfig DCfg; /* Diff configuration object */
1082
1083 if( find_option("tk",0,0)!=0 || has_option("tclsh") ){
1084 diff_tk("diff", 2);
1085 return;
1086 }
1087 isGDiff = g.argv[1][0]=='g';
 
1088 zFrom = find_option("from", "r", 1);
1089 zTo = find_option("to", 0, 1);
1090 zCheckin = find_option("checkin", 0, 1);
1091 zBranch = find_option("branch", 0, 1);
1092 againstUndo = find_option("undo",0,0)!=0;
 
 
 
 
 
 
1093 if( againstUndo && ( zFrom!=0 || zTo!=0 || zCheckin!=0 || zBranch!=0) ){
1094 fossil_fatal("cannot use --undo together with --from, --to, --checkin,"
1095 " or --branch");
1096 }
1097 if( zBranch ){
@@ -1169,18 +1110,11 @@
1110 }else if( zFrom==0 ){
1111 fossil_fatal("must use --from if --to is present");
1112 }else{
1113 db_find_and_open_repository(0, 0);
1114 }
1115 diff_options(&DCfg, isGDiff, 0);
 
 
 
 
 
 
 
1116 determine_exec_relative_option(1);
1117 verify_all_options();
1118 if( g.argc>=3 ){
1119 int i;
1120 Blob fname;
@@ -1214,18 +1148,15 @@
1148 if( againstUndo ){
1149 if( db_lget_int("undo_available",0)==0 ){
1150 fossil_print("No undo or redo is available\n");
1151 return;
1152 }
1153 diff_against_undo(&DCfg, pFileDir);
 
1154 }else if( zTo==0 ){
1155 diff_against_disk(zFrom, &DCfg, pFileDir, 0);
 
1156 }else{
1157 diff_two_versions(zFrom, zTo, &DCfg, pFileDir);
 
1158 }
1159 if( pFileDir ){
1160 int i;
1161 for(i=0; pFileDir[i].zName; i++){
1162 if( pFileDir[i].nUsed==0
@@ -1259,7 +1190,7 @@
1190 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1191 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
1192
1193 cgi_set_content_type("text/plain");
1194 diff_config_init(&DCfg, DIFF_VERBOSE);
1195 diff_two_versions(zFrom, zTo, &DCfg, 0);
1196 }
1197
+5 -31
--- src/patch.c
+++ src/patch.c
@@ -717,13 +717,10 @@
717717
/*
718718
** Show a diff for the patch currently loaded into database "patch".
719719
*/
720720
static void patch_diff(
721721
unsigned mFlags, /* Patch flags. only -f is allowed */
722
- const char *zDiffCmd, /* Command used for diffing */
723
- const char *zBinGlob, /* GLOB pattern to determine binary files */
724
- int fIncludeBinary, /* Do diffs against binary files */
725722
DiffConfig *pCfg /* Diff options */
726723
){
727724
int nErr = 0;
728725
Stmt q;
729726
int bWebpage = (pCfg->diffFlags & DIFF_WEBPAGE)!=0;
@@ -778,11 +775,10 @@
778775
" ORDER BY pathname"
779776
);
780777
while( db_step(&q)==SQLITE_ROW ){
781778
int rid;
782779
const char *zName;
783
- int isBin1, isBin2;
784780
Blob a, b;
785781
786782
if( db_column_type(&q,0)!=SQLITE_INTEGER
787783
&& db_column_type(&q,4)==SQLITE_TEXT
788784
){
@@ -805,35 +801,26 @@
805801
rid = db_column_int(&q, 0);
806802
807803
if( db_column_type(&q,3)==SQLITE_NULL ){
808804
if( !bWebpage ) fossil_print("DELETE %s\n", zName);
809805
diff_print_index(zName, pCfg, 0);
810
- isBin2 = 0;
811806
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);
807
+ diff_file_mem(&a, &empty, zName, pCfg);
815808
}else if( rid==0 ){
816809
db_ephemeral_blob(&q, 3, &a);
817810
blob_uncompress(&a, &a);
818811
if( !bWebpage ) fossil_print("ADDED %s\n", zName);
819812
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);
813
+ diff_file_mem(&empty, &a, zName, pCfg);
824814
blob_reset(&a);
825815
}else if( db_column_bytes(&q, 3)>0 ){
826816
Blob delta;
827817
db_ephemeral_blob(&q, 3, &delta);
828818
blob_uncompress(&delta, &delta);
829819
content_get(rid, &a);
830820
blob_delta_apply(&a, &delta, &b);
831
- isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
832
- isBin2 = fIncludeBinary ? 0 : looks_like_binary(&b);
833
- diff_file_mem(&a, &b, isBin1, isBin2, zName,
834
- zDiffCmd, zBinGlob, fIncludeBinary, pCfg);
821
+ diff_file_mem(&a, &b, zName, pCfg);
835822
blob_reset(&a);
836823
blob_reset(&b);
837824
blob_reset(&delta);
838825
}
839826
}
@@ -946,39 +933,26 @@
946933
db_must_be_within_tree();
947934
patch_create(flags, zOut, stdout);
948935
fossil_free(zOut);
949936
}else
950937
if( strncmp(zCmd, "diff", n)==0 ){
951
- const char *zDiffCmd = 0;
952
- const char *zBinGlob = 0;
953
- int fIncludeBinary = 0;
954938
char *zIn;
955939
unsigned flags = 0;
956940
DiffConfig DCfg;
957941
958942
if( find_option("tk",0,0)!=0 ){
959943
db_close(0);
960944
diff_tk("patch diff", 3);
961945
return;
962946
}
963
- diff_options(&DCfg, zCmd[0]=='g');
964
- if( find_option("internal","i",0)==0
965
- && (DCfg.diffFlags & DIFF_HTML)==0
966
- ){
967
- zDiffCmd = diff_command_external(zCmd[0]=='g');
968
- }
969
- if( find_option("verbose","v",0)!=0 ) DCfg.diffFlags |= DIFF_VERBOSE;
970
- if( zDiffCmd ){
971
- zBinGlob = diff_get_binary_glob();
972
- fIncludeBinary = diff_include_binary_files();
973
- }
947
+ diff_options(&DCfg, zCmd[0]=='g', 0);
974948
db_find_and_open_repository(0, 0);
975949
if( find_option("force","f",0) ) flags |= PATCH_FORCE;
976950
verify_all_options();
977951
zIn = patch_find_patch_filename("apply");
978952
patch_attach(zIn, stdin);
979
- patch_diff(flags, zDiffCmd, zBinGlob, fIncludeBinary, &DCfg);
953
+ patch_diff(flags, &DCfg);
980954
fossil_free(zIn);
981955
}else
982956
if( strncmp(zCmd, "pull", n)==0 ){
983957
FILE *pIn = 0;
984958
unsigned flags = 0;
985959
--- src/patch.c
+++ src/patch.c
@@ -717,13 +717,10 @@
717 /*
718 ** Show a diff for the patch currently loaded into database "patch".
719 */
720 static void patch_diff(
721 unsigned mFlags, /* Patch flags. only -f is allowed */
722 const char *zDiffCmd, /* Command used for diffing */
723 const char *zBinGlob, /* GLOB pattern to determine binary files */
724 int fIncludeBinary, /* Do diffs against binary files */
725 DiffConfig *pCfg /* Diff options */
726 ){
727 int nErr = 0;
728 Stmt q;
729 int bWebpage = (pCfg->diffFlags & DIFF_WEBPAGE)!=0;
@@ -778,11 +775,10 @@
778 " ORDER BY pathname"
779 );
780 while( db_step(&q)==SQLITE_ROW ){
781 int rid;
782 const char *zName;
783 int isBin1, isBin2;
784 Blob a, b;
785
786 if( db_column_type(&q,0)!=SQLITE_INTEGER
787 && db_column_type(&q,4)==SQLITE_TEXT
788 ){
@@ -805,35 +801,26 @@
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);
825 }else if( db_column_bytes(&q, 3)>0 ){
826 Blob delta;
827 db_ephemeral_blob(&q, 3, &delta);
828 blob_uncompress(&delta, &delta);
829 content_get(rid, &a);
830 blob_delta_apply(&a, &delta, &b);
831 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
832 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&b);
833 diff_file_mem(&a, &b, isBin1, isBin2, zName,
834 zDiffCmd, zBinGlob, fIncludeBinary, pCfg);
835 blob_reset(&a);
836 blob_reset(&b);
837 blob_reset(&delta);
838 }
839 }
@@ -946,39 +933,26 @@
946 db_must_be_within_tree();
947 patch_create(flags, zOut, stdout);
948 fossil_free(zOut);
949 }else
950 if( strncmp(zCmd, "diff", n)==0 ){
951 const char *zDiffCmd = 0;
952 const char *zBinGlob = 0;
953 int fIncludeBinary = 0;
954 char *zIn;
955 unsigned flags = 0;
956 DiffConfig DCfg;
957
958 if( find_option("tk",0,0)!=0 ){
959 db_close(0);
960 diff_tk("patch diff", 3);
961 return;
962 }
963 diff_options(&DCfg, zCmd[0]=='g');
964 if( find_option("internal","i",0)==0
965 && (DCfg.diffFlags & DIFF_HTML)==0
966 ){
967 zDiffCmd = diff_command_external(zCmd[0]=='g');
968 }
969 if( find_option("verbose","v",0)!=0 ) DCfg.diffFlags |= DIFF_VERBOSE;
970 if( zDiffCmd ){
971 zBinGlob = diff_get_binary_glob();
972 fIncludeBinary = diff_include_binary_files();
973 }
974 db_find_and_open_repository(0, 0);
975 if( find_option("force","f",0) ) flags |= PATCH_FORCE;
976 verify_all_options();
977 zIn = patch_find_patch_filename("apply");
978 patch_attach(zIn, stdin);
979 patch_diff(flags, zDiffCmd, zBinGlob, fIncludeBinary, &DCfg);
980 fossil_free(zIn);
981 }else
982 if( strncmp(zCmd, "pull", n)==0 ){
983 FILE *pIn = 0;
984 unsigned flags = 0;
985
--- src/patch.c
+++ src/patch.c
@@ -717,13 +717,10 @@
717 /*
718 ** Show a diff for the patch currently loaded into database "patch".
719 */
720 static void patch_diff(
721 unsigned mFlags, /* Patch flags. only -f is allowed */
 
 
 
722 DiffConfig *pCfg /* Diff options */
723 ){
724 int nErr = 0;
725 Stmt q;
726 int bWebpage = (pCfg->diffFlags & DIFF_WEBPAGE)!=0;
@@ -778,11 +775,10 @@
775 " ORDER BY pathname"
776 );
777 while( db_step(&q)==SQLITE_ROW ){
778 int rid;
779 const char *zName;
 
780 Blob a, b;
781
782 if( db_column_type(&q,0)!=SQLITE_INTEGER
783 && db_column_type(&q,4)==SQLITE_TEXT
784 ){
@@ -805,35 +801,26 @@
801 rid = db_column_int(&q, 0);
802
803 if( db_column_type(&q,3)==SQLITE_NULL ){
804 if( !bWebpage ) fossil_print("DELETE %s\n", zName);
805 diff_print_index(zName, pCfg, 0);
 
806 content_get(rid, &a);
807 diff_file_mem(&a, &empty, zName, pCfg);
 
 
808 }else if( rid==0 ){
809 db_ephemeral_blob(&q, 3, &a);
810 blob_uncompress(&a, &a);
811 if( !bWebpage ) fossil_print("ADDED %s\n", zName);
812 diff_print_index(zName, pCfg, 0);
813 diff_file_mem(&empty, &a, zName, pCfg);
 
 
 
814 blob_reset(&a);
815 }else if( db_column_bytes(&q, 3)>0 ){
816 Blob delta;
817 db_ephemeral_blob(&q, 3, &delta);
818 blob_uncompress(&delta, &delta);
819 content_get(rid, &a);
820 blob_delta_apply(&a, &delta, &b);
821 diff_file_mem(&a, &b, zName, pCfg);
 
 
 
822 blob_reset(&a);
823 blob_reset(&b);
824 blob_reset(&delta);
825 }
826 }
@@ -946,39 +933,26 @@
933 db_must_be_within_tree();
934 patch_create(flags, zOut, stdout);
935 fossil_free(zOut);
936 }else
937 if( strncmp(zCmd, "diff", n)==0 ){
 
 
 
938 char *zIn;
939 unsigned flags = 0;
940 DiffConfig DCfg;
941
942 if( find_option("tk",0,0)!=0 ){
943 db_close(0);
944 diff_tk("patch diff", 3);
945 return;
946 }
947 diff_options(&DCfg, zCmd[0]=='g', 0);
 
 
 
 
 
 
 
 
 
 
948 db_find_and_open_repository(0, 0);
949 if( find_option("force","f",0) ) flags |= PATCH_FORCE;
950 verify_all_options();
951 zIn = patch_find_patch_filename("apply");
952 patch_attach(zIn, stdin);
953 patch_diff(flags, &DCfg);
954 fossil_free(zIn);
955 }else
956 if( strncmp(zCmd, "pull", n)==0 ){
957 FILE *pIn = 0;
958 unsigned flags = 0;
959
+7 -35
--- src/stash.c
+++ src/stash.c
@@ -402,19 +402,16 @@
402402
/*
403403
** Show the diffs associate with a single stash.
404404
*/
405405
static void stash_diff(
406406
int stashid, /* The stash entry to diff */
407
- const char *zDiffCmd, /* Command used for diffing */
408
- const char *zBinGlob, /* GLOB pattern to determine binary files */
409407
int fBaseline, /* Diff against original baseline check-in if true */
410
- int fIncludeBinary, /* Do diffs against binary files */
411408
DiffConfig *pCfg /* Diff formatting options */
412409
){
413410
Stmt q;
414411
Blob empty;
415
- int bWebpage = (pCfg->diffFlags & DIFF_WEBPAGE)!=0;
412
+ int bWebpage = (pCfg->diffFlags & (DIFF_WEBPAGE|DIFF_JSON|DIFF_TCL))!=0;
416413
blob_zero(&empty);
417414
diff_begin(pCfg);
418415
db_prepare(&q,
419416
"SELECT blob.rid, isRemoved, isExec, isLink, origname, newname, delta"
420417
" FROM stashfile, blob WHERE stashid=%d AND blob.uuid=stashfile.hash",
@@ -422,32 +419,25 @@
422419
);
423420
while( db_step(&q)==SQLITE_ROW ){
424421
int rid = db_column_int(&q, 0);
425422
int isRemoved = db_column_int(&q, 1);
426423
int isLink = db_column_int(&q, 3);
427
- int isBin1, isBin2;
428424
const char *zOrig = db_column_text(&q, 4);
429425
const char *zNew = db_column_text(&q, 5);
430426
char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
431427
Blob a, b;
432428
if( rid==0 ){
433429
db_ephemeral_blob(&q, 6, &a);
434430
if( !bWebpage ) fossil_print("ADDED %s\n", zNew);
435431
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);
432
+ diff_file_mem(&empty, &a, zNew, pCfg);
440433
}else if( isRemoved ){
441434
if( !bWebpage) fossil_print("DELETE %s\n", zOrig);
442435
diff_print_index(zNew, pCfg, 0);
443
- isBin2 = 0;
444436
if( fBaseline ){
445437
content_get(rid, &a);
446
- isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
447
- diff_file_mem(&a, &empty, isBin1, isBin2, zOrig, zDiffCmd,
448
- zBinGlob, fIncludeBinary, pCfg);
438
+ diff_file_mem(&a, &empty, zOrig, pCfg);
449439
}
450440
}else{
451441
Blob delta;
452442
int isOrigLink = file_islink(zOPath);
453443
db_ephemeral_blob(&q, 6, &delta);
@@ -457,20 +447,16 @@
457447
diff_print_filenames(zOrig, zNew, pCfg, 0);
458448
printf(DIFF_CANNOT_COMPUTE_SYMLINK);
459449
}else{
460450
content_get(rid, &a);
461451
blob_delta_apply(&a, &delta, &b);
462
- isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
463
- isBin2 = fIncludeBinary ? 0 : looks_like_binary(&b);
464452
if( fBaseline ){
465
- diff_file_mem(&a, &b, isBin1, isBin2, zNew,
466
- zDiffCmd, zBinGlob, fIncludeBinary, pCfg);
453
+ diff_file_mem(&a, &b, zNew, pCfg);
467454
}else{
468455
/*Diff with file on disk using fSwapDiff=1 to show the diff in the
469456
same direction as if fBaseline=1.*/
470
- diff_file(&b, isBin2, zOPath, zNew, zDiffCmd,
471
- zBinGlob, fIncludeBinary, pCfg, 1, 0);
457
+ diff_file(&b, zOPath, zNew, pCfg, 1, 0);
472458
}
473459
blob_reset(&a);
474460
blob_reset(&b);
475461
}
476462
blob_reset(&delta);
@@ -740,13 +726,10 @@
740726
|| memcmp(zCmd, "show", nCmd)==0
741727
|| memcmp(zCmd, "gshow", nCmd)==0
742728
|| memcmp(zCmd, "cat", nCmd)==0
743729
|| memcmp(zCmd, "gcat", nCmd)==0
744730
){
745
- const char *zDiffCmd = 0;
746
- const char *zBinGlob = 0;
747
- int fIncludeBinary = 0;
748731
int fBaseline = 0;
749732
DiffConfig DCfg;
750733
751734
if( strstr(zCmd,"show")!=0 || strstr(zCmd,"cat")!=0 ){
752735
fBaseline = 1;
@@ -754,24 +737,13 @@
754737
if( find_option("tk",0,0)!=0 ){
755738
db_close(0);
756739
diff_tk(fBaseline ? "stash show" : "stash diff", 3);
757740
return;
758741
}
759
- diff_options(&DCfg, zCmd[0]=='g');
760
- if( find_option("internal","i",0)==0
761
- && (DCfg.diffFlags & DIFF_HTML)==0
762
- ){
763
- zDiffCmd = diff_command_external(zCmd[0]=='g');
764
- }
765
- if( find_option("verbose","v",0)!=0 ) DCfg.diffFlags |= DIFF_VERBOSE;
766
- if( g.argc>4 ) usage(mprintf("%s ?STASHID? ?DIFF-OPTIONS?", zCmd));
767
- if( zDiffCmd ){
768
- zBinGlob = diff_get_binary_glob();
769
- fIncludeBinary = diff_include_binary_files();
770
- }
742
+ diff_options(&DCfg, zCmd[0]=='g', 0);
771743
stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
772
- stash_diff(stashid, zDiffCmd, zBinGlob, fBaseline, fIncludeBinary, &DCfg);
744
+ stash_diff(stashid, fBaseline, &DCfg);
773745
}else
774746
if( memcmp(zCmd, "help", nCmd)==0 ){
775747
g.argv[1] = "help";
776748
g.argv[2] = "stash";
777749
g.argc = 3;
778750
--- src/stash.c
+++ src/stash.c
@@ -402,19 +402,16 @@
402 /*
403 ** Show the diffs associate with a single stash.
404 */
405 static void stash_diff(
406 int stashid, /* The stash entry to diff */
407 const char *zDiffCmd, /* Command used for diffing */
408 const char *zBinGlob, /* GLOB pattern to determine binary files */
409 int fBaseline, /* Diff against original baseline check-in if true */
410 int fIncludeBinary, /* Do diffs against binary files */
411 DiffConfig *pCfg /* Diff formatting options */
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",
@@ -422,32 +419,25 @@
422 );
423 while( db_step(&q)==SQLITE_ROW ){
424 int rid = db_column_int(&q, 0);
425 int isRemoved = db_column_int(&q, 1);
426 int isLink = db_column_int(&q, 3);
427 int isBin1, isBin2;
428 const char *zOrig = db_column_text(&q, 4);
429 const char *zNew = db_column_text(&q, 5);
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,
448 zBinGlob, fIncludeBinary, pCfg);
449 }
450 }else{
451 Blob delta;
452 int isOrigLink = file_islink(zOPath);
453 db_ephemeral_blob(&q, 6, &delta);
@@ -457,20 +447,16 @@
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);
463 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&b);
464 if( fBaseline ){
465 diff_file_mem(&a, &b, isBin1, isBin2, zNew,
466 zDiffCmd, zBinGlob, fIncludeBinary, pCfg);
467 }else{
468 /*Diff with file on disk using fSwapDiff=1 to show the diff in the
469 same direction as if fBaseline=1.*/
470 diff_file(&b, isBin2, zOPath, zNew, zDiffCmd,
471 zBinGlob, fIncludeBinary, pCfg, 1, 0);
472 }
473 blob_reset(&a);
474 blob_reset(&b);
475 }
476 blob_reset(&delta);
@@ -740,13 +726,10 @@
740 || memcmp(zCmd, "show", nCmd)==0
741 || memcmp(zCmd, "gshow", nCmd)==0
742 || memcmp(zCmd, "cat", nCmd)==0
743 || memcmp(zCmd, "gcat", nCmd)==0
744 ){
745 const char *zDiffCmd = 0;
746 const char *zBinGlob = 0;
747 int fIncludeBinary = 0;
748 int fBaseline = 0;
749 DiffConfig DCfg;
750
751 if( strstr(zCmd,"show")!=0 || strstr(zCmd,"cat")!=0 ){
752 fBaseline = 1;
@@ -754,24 +737,13 @@
754 if( find_option("tk",0,0)!=0 ){
755 db_close(0);
756 diff_tk(fBaseline ? "stash show" : "stash diff", 3);
757 return;
758 }
759 diff_options(&DCfg, zCmd[0]=='g');
760 if( find_option("internal","i",0)==0
761 && (DCfg.diffFlags & DIFF_HTML)==0
762 ){
763 zDiffCmd = diff_command_external(zCmd[0]=='g');
764 }
765 if( find_option("verbose","v",0)!=0 ) DCfg.diffFlags |= DIFF_VERBOSE;
766 if( g.argc>4 ) usage(mprintf("%s ?STASHID? ?DIFF-OPTIONS?", zCmd));
767 if( zDiffCmd ){
768 zBinGlob = diff_get_binary_glob();
769 fIncludeBinary = diff_include_binary_files();
770 }
771 stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
772 stash_diff(stashid, zDiffCmd, zBinGlob, fBaseline, fIncludeBinary, &DCfg);
773 }else
774 if( memcmp(zCmd, "help", nCmd)==0 ){
775 g.argv[1] = "help";
776 g.argv[2] = "stash";
777 g.argc = 3;
778
--- src/stash.c
+++ src/stash.c
@@ -402,19 +402,16 @@
402 /*
403 ** Show the diffs associate with a single stash.
404 */
405 static void stash_diff(
406 int stashid, /* The stash entry to diff */
 
 
407 int fBaseline, /* Diff against original baseline check-in if true */
 
408 DiffConfig *pCfg /* Diff formatting options */
409 ){
410 Stmt q;
411 Blob empty;
412 int bWebpage = (pCfg->diffFlags & (DIFF_WEBPAGE|DIFF_JSON|DIFF_TCL))!=0;
413 blob_zero(&empty);
414 diff_begin(pCfg);
415 db_prepare(&q,
416 "SELECT blob.rid, isRemoved, isExec, isLink, origname, newname, delta"
417 " FROM stashfile, blob WHERE stashid=%d AND blob.uuid=stashfile.hash",
@@ -422,32 +419,25 @@
419 );
420 while( db_step(&q)==SQLITE_ROW ){
421 int rid = db_column_int(&q, 0);
422 int isRemoved = db_column_int(&q, 1);
423 int isLink = db_column_int(&q, 3);
 
424 const char *zOrig = db_column_text(&q, 4);
425 const char *zNew = db_column_text(&q, 5);
426 char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
427 Blob a, b;
428 if( rid==0 ){
429 db_ephemeral_blob(&q, 6, &a);
430 if( !bWebpage ) fossil_print("ADDED %s\n", zNew);
431 diff_print_index(zNew, pCfg, 0);
432 diff_file_mem(&empty, &a, zNew, pCfg);
 
 
 
433 }else if( isRemoved ){
434 if( !bWebpage) fossil_print("DELETE %s\n", zOrig);
435 diff_print_index(zNew, pCfg, 0);
 
436 if( fBaseline ){
437 content_get(rid, &a);
438 diff_file_mem(&a, &empty, zOrig, pCfg);
 
 
439 }
440 }else{
441 Blob delta;
442 int isOrigLink = file_islink(zOPath);
443 db_ephemeral_blob(&q, 6, &delta);
@@ -457,20 +447,16 @@
447 diff_print_filenames(zOrig, zNew, pCfg, 0);
448 printf(DIFF_CANNOT_COMPUTE_SYMLINK);
449 }else{
450 content_get(rid, &a);
451 blob_delta_apply(&a, &delta, &b);
 
 
452 if( fBaseline ){
453 diff_file_mem(&a, &b, zNew, pCfg);
 
454 }else{
455 /*Diff with file on disk using fSwapDiff=1 to show the diff in the
456 same direction as if fBaseline=1.*/
457 diff_file(&b, zOPath, zNew, pCfg, 1, 0);
 
458 }
459 blob_reset(&a);
460 blob_reset(&b);
461 }
462 blob_reset(&delta);
@@ -740,13 +726,10 @@
726 || memcmp(zCmd, "show", nCmd)==0
727 || memcmp(zCmd, "gshow", nCmd)==0
728 || memcmp(zCmd, "cat", nCmd)==0
729 || memcmp(zCmd, "gcat", nCmd)==0
730 ){
 
 
 
731 int fBaseline = 0;
732 DiffConfig DCfg;
733
734 if( strstr(zCmd,"show")!=0 || strstr(zCmd,"cat")!=0 ){
735 fBaseline = 1;
@@ -754,24 +737,13 @@
737 if( find_option("tk",0,0)!=0 ){
738 db_close(0);
739 diff_tk(fBaseline ? "stash show" : "stash diff", 3);
740 return;
741 }
742 diff_options(&DCfg, zCmd[0]=='g', 0);
 
 
 
 
 
 
 
 
 
 
 
743 stashid = stash_get_id(g.argc==4 ? g.argv[3] : 0);
744 stash_diff(stashid, fBaseline, &DCfg);
745 }else
746 if( memcmp(zCmd, "help", nCmd)==0 ){
747 g.argv[1] = "help";
748 g.argv[2] = "stash";
749 g.argc = 3;
750

Keyboard Shortcuts

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