Fossil SCM

Continue integrating DiffConfig up the diff stack.

drh 2021-09-06 18:52 diff-config
Commit 153a464dab03b33c8c79955f4de97333184c80afd136fd7881347f37baf98a9a
+4 -2
--- src/checkin.c
+++ src/checkin.c
@@ -1338,15 +1338,17 @@
13381338
"# All merged-in branches will be closed due to the --integrate flag\n"
13391339
"#\n", -1
13401340
);
13411341
}
13421342
if( p->verboseFlag ){
1343
+ DiffConfig DCfg;
13431344
blob_appendf(&prompt,
13441345
"#\n%.78c\n"
13451346
"# The following diff is excluded from the commit message:\n#\n",
13461347
'#'
13471348
);
1349
+ diff_config_init(&DCfg, DIFF_VERBOSE);
13481350
if( g.aCommitFile ){
13491351
FileDirList *diffFiles;
13501352
int i;
13511353
diffFiles = fossil_malloc_zero((g.argc-1) * sizeof(*diffFiles));
13521354
for( i=0; g.aCommitFile[i]!=0; ++i ){
@@ -1360,19 +1362,19 @@
13601362
diffFiles[i].nName = strlen(diffFiles[i].zName);
13611363
diffFiles[i].nUsed = 0;
13621364
}
13631365
diff_against_disk(0, 0, diff_get_binary_glob(),
13641366
db_get_boolean("diff-binary", 1),
1365
- DIFF_VERBOSE, diffFiles, &prompt);
1367
+ &DCfg, diffFiles, &prompt);
13661368
for( i=0; diffFiles[i].zName; ++i ){
13671369
fossil_free(diffFiles[i].zName);
13681370
}
13691371
fossil_free(diffFiles);
13701372
}else{
13711373
diff_against_disk(0, 0, diff_get_binary_glob(),
13721374
db_get_boolean("diff-binary", 1),
1373
- DIFF_VERBOSE, 0, &prompt);
1375
+ &DCfg, 0, &prompt);
13741376
}
13751377
}
13761378
prompt_for_user_comment(pComment, &prompt);
13771379
blob_reset(&prompt);
13781380
}
13791381
--- src/checkin.c
+++ src/checkin.c
@@ -1338,15 +1338,17 @@
1338 "# All merged-in branches will be closed due to the --integrate flag\n"
1339 "#\n", -1
1340 );
1341 }
1342 if( p->verboseFlag ){
 
1343 blob_appendf(&prompt,
1344 "#\n%.78c\n"
1345 "# The following diff is excluded from the commit message:\n#\n",
1346 '#'
1347 );
 
1348 if( g.aCommitFile ){
1349 FileDirList *diffFiles;
1350 int i;
1351 diffFiles = fossil_malloc_zero((g.argc-1) * sizeof(*diffFiles));
1352 for( i=0; g.aCommitFile[i]!=0; ++i ){
@@ -1360,19 +1362,19 @@
1360 diffFiles[i].nName = strlen(diffFiles[i].zName);
1361 diffFiles[i].nUsed = 0;
1362 }
1363 diff_against_disk(0, 0, diff_get_binary_glob(),
1364 db_get_boolean("diff-binary", 1),
1365 DIFF_VERBOSE, diffFiles, &prompt);
1366 for( i=0; diffFiles[i].zName; ++i ){
1367 fossil_free(diffFiles[i].zName);
1368 }
1369 fossil_free(diffFiles);
1370 }else{
1371 diff_against_disk(0, 0, diff_get_binary_glob(),
1372 db_get_boolean("diff-binary", 1),
1373 DIFF_VERBOSE, 0, &prompt);
1374 }
1375 }
1376 prompt_for_user_comment(pComment, &prompt);
1377 blob_reset(&prompt);
1378 }
1379
--- src/checkin.c
+++ src/checkin.c
@@ -1338,15 +1338,17 @@
1338 "# All merged-in branches will be closed due to the --integrate flag\n"
1339 "#\n", -1
1340 );
1341 }
1342 if( p->verboseFlag ){
1343 DiffConfig DCfg;
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,19 +1362,19 @@
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
+40 -41
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -399,11 +399,11 @@
399399
const char *zFile2, /* On disk content to compare to */
400400
const char *zName, /* Display name of the file */
401401
const char *zDiffCmd, /* Command for comparison */
402402
const char *zBinGlob, /* Treat file names matching this as binary */
403403
int fIncludeBinary, /* Include binary files for external diff */
404
- u64 diffFlags, /* Flags to control the diff */
404
+ DiffConfig *pCfg, /* Flags to control the diff */
405405
int fSwapDiff, /* Diff from Zfile2 to Pfile1 */
406406
Blob *diffBlob /* Blob to store diff output */
407407
){
408408
if( zDiffCmd==0 ){
409409
Blob out; /* Diff output text */
@@ -418,36 +418,34 @@
418418
blob_read_from_file(&file2, zFile2, ExtFILE);
419419
zName2 = zName;
420420
}
421421
422422
/* Compute and output the differences */
423
- if( diffFlags & DIFF_BRIEF ){
423
+ if( pCfg->diffFlags & DIFF_BRIEF ){
424424
if( blob_compare(pFile1, &file2) ){
425425
fossil_print("CHANGED %s\n", zName);
426426
}
427427
}else{
428
- DiffConfig DCfg;
429
- diff_config_init(&DCfg, diffFlags);
430428
blob_zero(&out);
431429
if( fSwapDiff ){
432
- text_diff(&file2, pFile1, &out, 0, &DCfg);
430
+ text_diff(&file2, pFile1, &out, 0, pCfg);
433431
}else{
434
- text_diff(pFile1, &file2, &out, 0, &DCfg);
432
+ text_diff(pFile1, &file2, &out, 0, pCfg);
435433
}
436434
if( blob_size(&out) ){
437
- if( diffFlags & DIFF_NUMSTAT ){
435
+ if( pCfg->diffFlags & DIFF_NUMSTAT ){
438436
if( !diffBlob ){
439437
fossil_print("%s %s\n", blob_str(&out), zName);
440438
}else{
441439
blob_appendf(diffBlob, "%s %s\n", blob_str(&out), zName);
442440
}
443441
}else{
444442
if( !diffBlob ){
445
- diff_print_filenames(zName, zName2, diffFlags, 0);
443
+ diff_print_filenames(zName, zName2, pCfg->diffFlags, 0);
446444
fossil_print("%s\n", blob_str(&out));
447445
}else{
448
- diff_print_filenames(zName, zName2, diffFlags, diffBlob);
446
+ diff_print_filenames(zName, zName2, pCfg->diffFlags, diffBlob);
449447
blob_appendf(diffBlob, "%s\n", blob_str(&out));
450448
}
451449
}
452450
}
453451
blob_reset(&out);
@@ -532,24 +530,22 @@
532530
int isBin2, /* Does the 'to' content appear to be binary */
533531
const char *zName, /* Display name of the file */
534532
const char *zDiffCmd, /* Command for comparison */
535533
const char *zBinGlob, /* Treat file names matching this as binary */
536534
int fIncludeBinary, /* Include binary files for external diff */
537
- u64 diffFlags /* Diff flags */
535
+ DiffConfig *pCfg /* Diff flags */
538536
){
539
- if( diffFlags & DIFF_BRIEF ) return;
537
+ if( pCfg->diffFlags & DIFF_BRIEF ) return;
540538
if( zDiffCmd==0 ){
541539
Blob out; /* Diff output text */
542
- DiffConfig DCfg;
543540
544
- diff_config_init(&DCfg, diffFlags);
545541
blob_zero(&out);
546
- text_diff(pFile1, pFile2, &out, 0, &DCfg);
547
- if( diffFlags & DIFF_NUMSTAT ){
542
+ text_diff(pFile1, pFile2, &out, 0, pCfg);
543
+ if( pCfg->diffFlags & DIFF_NUMSTAT ){
548544
fossil_print("%s %s\n", blob_str(&out), zName);
549545
}else{
550
- diff_print_filenames(zName, zName, diffFlags, 0);
546
+ diff_print_filenames(zName, zName, pCfg->diffFlags, 0);
551547
fossil_print("%s\n", blob_str(&out));
552548
}
553549
554550
/* Release memory resources */
555551
blob_reset(&out);
@@ -614,22 +610,22 @@
614610
void diff_against_disk(
615611
const char *zFrom, /* Version to difference from */
616612
const char *zDiffCmd, /* Use this diff command. NULL for built-in */
617613
const char *zBinGlob, /* Treat file names matching this as binary */
618614
int fIncludeBinary, /* Treat file names matching this as binary */
619
- u64 diffFlags, /* Flags controlling diff output */
615
+ DiffConfig *pCfg, /* Flags controlling diff output */
620616
FileDirList *pFileDir, /* Which files to diff */
621617
Blob *diffBlob /* Blob to output diff instead of stdout */
622618
){
623619
int vid;
624620
Blob sql;
625621
Stmt q;
626622
int asNewFile; /* Treat non-existant files as empty files */
627623
int isNumStat; /* True for --numstat */
628624
629
- asNewFile = (diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT|DIFF_HTML))!=0;
630
- isNumStat = (diffFlags & (DIFF_NUMSTAT|DIFF_TCL|DIFF_HTML))!=0;
625
+ asNewFile = (pCfg->diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT|DIFF_HTML))!=0;
626
+ isNumStat = (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_TCL|DIFF_HTML))!=0;
631627
vid = db_lget_int("checkout", 0);
632628
vfile_check_signature(vid, CKSIG_ENOTFILE);
633629
blob_zero(&sql);
634630
db_begin_transaction();
635631
if( zFrom ){
@@ -711,24 +707,24 @@
711707
}
712708
if( showDiff ){
713709
Blob content;
714710
int isBin;
715711
if( !isLink != !file_islink(zFullName) ){
716
- diff_print_index(zPathname, diffFlags, 0);
717
- diff_print_filenames(zPathname, zPathname, diffFlags, 0);
712
+ diff_print_index(zPathname, pCfg->diffFlags, 0);
713
+ diff_print_filenames(zPathname, zPathname, pCfg->diffFlags, 0);
718714
fossil_print("%s",DIFF_CANNOT_COMPUTE_SYMLINK);
719715
continue;
720716
}
721717
if( srcid>0 ){
722718
content_get(srcid, &content);
723719
}else{
724720
blob_zero(&content);
725721
}
726722
isBin = fIncludeBinary ? 0 : looks_like_binary(&content);
727
- diff_print_index(zPathname, diffFlags, diffBlob);
723
+ diff_print_index(zPathname, pCfg->diffFlags, diffBlob);
728724
diff_file(&content, isBin, zFullName, zPathname, zDiffCmd,
729
- zBinGlob, fIncludeBinary, diffFlags, 0, diffBlob);
725
+ zBinGlob, fIncludeBinary, pCfg, 0, diffBlob);
730726
blob_reset(&content);
731727
}
732728
blob_reset(&fname);
733729
}
734730
db_finalize(&q);
@@ -747,11 +743,11 @@
747743
*/
748744
static void diff_against_undo(
749745
const char *zDiffCmd, /* Use this diff command. NULL for built-in */
750746
const char *zBinGlob, /* Treat file names matching this as binary */
751747
int fIncludeBinary, /* Treat file names matching this as binary */
752
- u64 diffFlags, /* Flags controlling diff output */
748
+ DiffConfig *pCfg, /* Flags controlling diff output */
753749
FileDirList *pFileDir /* List of files and directories to diff */
754750
){
755751
Stmt q;
756752
Blob content;
757753
db_prepare(&q, "SELECT pathname, content FROM undo");
@@ -761,11 +757,11 @@
761757
const char *zFile = (const char*)db_column_text(&q, 0);
762758
if( !file_dir_match(pFileDir, zFile) ) continue;
763759
zFullName = mprintf("%s%s", g.zLocalRoot, zFile);
764760
db_column_blob(&q, 1, &content);
765761
diff_file(&content, 0, zFullName, zFile,
766
- zDiffCmd, zBinGlob, fIncludeBinary, diffFlags, 0, 0);
762
+ zDiffCmd, zBinGlob, fIncludeBinary, pCfg, 0, 0);
767763
fossil_free(zFullName);
768764
blob_reset(&content);
769765
}
770766
db_finalize(&q);
771767
}
@@ -785,11 +781,11 @@
785781
struct ManifestFile *pFrom,
786782
struct ManifestFile *pTo,
787783
const char *zDiffCmd,
788784
const char *zBinGlob,
789785
int fIncludeBinary,
790
- u64 diffFlags
786
+ DiffConfig *pCfg
791787
){
792788
Blob f1, f2;
793789
int isBin1, isBin2;
794790
int rid;
795791
const char *zName;
@@ -798,12 +794,12 @@
798794
}else if( pTo ){
799795
zName = pTo->zName;
800796
}else{
801797
zName = DIFF_NO_NAME;
802798
}
803
- if( diffFlags & DIFF_BRIEF ) return;
804
- diff_print_index(zName, diffFlags, 0);
799
+ if( pCfg->diffFlags & DIFF_BRIEF ) return;
800
+ diff_print_index(zName, pCfg->diffFlags, 0);
805801
if( pFrom ){
806802
rid = uuid_to_rid(pFrom->zUuid, 0);
807803
content_get(rid, &f1);
808804
}else{
809805
blob_zero(&f1);
@@ -815,11 +811,11 @@
815811
blob_zero(&f2);
816812
}
817813
isBin1 = fIncludeBinary ? 0 : looks_like_binary(&f1);
818814
isBin2 = fIncludeBinary ? 0 : looks_like_binary(&f2);
819815
diff_file_mem(&f1, &f2, isBin1, isBin2, zName, zDiffCmd,
820
- zBinGlob, fIncludeBinary, diffFlags);
816
+ zBinGlob, fIncludeBinary, pCfg);
821817
blob_reset(&f1);
822818
blob_reset(&f2);
823819
}
824820
825821
/*
@@ -836,16 +832,16 @@
836832
const char *zFrom,
837833
const char *zTo,
838834
const char *zDiffCmd,
839835
const char *zBinGlob,
840836
int fIncludeBinary,
841
- u64 diffFlags,
837
+ DiffConfig *pCfg,
842838
FileDirList *pFileDir
843839
){
844840
Manifest *pFrom, *pTo;
845841
ManifestFile *pFromFile, *pToFile;
846
- int asNewFlag = (diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT))!=0 ? 1 : 0;
842
+ int asNewFlag = (pCfg->diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT))!=0 ? 1 : 0;
847843
848844
pFrom = manifest_get_by_name(zFrom, 0);
849845
manifest_file_rewind(pFrom);
850846
pFromFile = manifest_file_next(pFrom,0);
851847
pTo = manifest_get_by_name(zTo, 0);
@@ -861,27 +857,28 @@
861857
}else{
862858
cmp = fossil_strcmp(pFromFile->zName, pToFile->zName);
863859
}
864860
if( cmp<0 ){
865861
if( file_dir_match(pFileDir, pFromFile->zName) ){
866
- if( (diffFlags & (DIFF_NUMSTAT|DIFF_HTML))==0 ){
862
+ if( (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_HTML))==0 ){
867863
fossil_print("DELETED %s\n", pFromFile->zName);
868864
}
869865
if( asNewFlag ){
870866
diff_manifest_entry(pFromFile, 0, zDiffCmd, zBinGlob,
871
- fIncludeBinary, diffFlags);
867
+ fIncludeBinary, pCfg);
872868
}
873869
}
874870
pFromFile = manifest_file_next(pFrom,0);
875871
}else if( cmp>0 ){
876872
if( file_dir_match(pFileDir, pToFile->zName) ){
877
- if( (diffFlags & (DIFF_NUMSTAT|DIFF_HTML|DIFF_TCL|DIFF_JSON))==0 ){
873
+ if( (pCfg->diffFlags &
874
+ (DIFF_NUMSTAT|DIFF_HTML|DIFF_TCL|DIFF_JSON))==0 ){
878875
fossil_print("ADDED %s\n", pToFile->zName);
879876
}
880877
if( asNewFlag ){
881878
diff_manifest_entry(0, pToFile, zDiffCmd, zBinGlob,
882
- fIncludeBinary, diffFlags);
879
+ fIncludeBinary, pCfg);
883880
}
884881
}
885882
pToFile = manifest_file_next(pTo,0);
886883
}else if( fossil_strcmp(pFromFile->zUuid, pToFile->zUuid)==0 ){
887884
/* No changes */
@@ -888,15 +885,15 @@
888885
(void)file_dir_match(pFileDir, pFromFile->zName); /* Record name usage */
889886
pFromFile = manifest_file_next(pFrom,0);
890887
pToFile = manifest_file_next(pTo,0);
891888
}else{
892889
if( file_dir_match(pFileDir, pToFile->zName) ){
893
- if( diffFlags & DIFF_BRIEF ){
890
+ if( pCfg->diffFlags & DIFF_BRIEF ){
894891
fossil_print("CHANGED %s\n", pFromFile->zName);
895892
}else{
896893
diff_manifest_entry(pFromFile, pToFile, zDiffCmd, zBinGlob,
897
- fIncludeBinary, diffFlags);
894
+ fIncludeBinary, pCfg);
898895
}
899896
}
900897
pFromFile = manifest_file_next(pFrom,0);
901898
pToFile = manifest_file_next(pTo,0);
902899
}
@@ -1200,17 +1197,17 @@
12001197
if( db_lget_int("undo_available",0)==0 ){
12011198
fossil_print("No undo or redo is available\n");
12021199
return;
12031200
}
12041201
diff_against_undo(zDiffCmd, zBinGlob, fIncludeBinary,
1205
- DCfg.diffFlags, pFileDir);
1202
+ &DCfg, pFileDir);
12061203
}else if( zTo==0 ){
12071204
diff_against_disk(zFrom, zDiffCmd, zBinGlob, fIncludeBinary,
1208
- DCfg.diffFlags, pFileDir, 0);
1205
+ &DCfg, pFileDir, 0);
12091206
}else{
12101207
diff_two_versions(zFrom, zTo, zDiffCmd, zBinGlob, fIncludeBinary,
1211
- DCfg.diffFlags, pFileDir);
1208
+ &DCfg, pFileDir);
12121209
}
12131210
if( pFileDir ){
12141211
int i;
12151212
for(i=0; pFileDir[i].zName; i++){
12161213
if( pFileDir[i].nUsed==0
@@ -1237,12 +1234,14 @@
12371234
** Show a patch that goes from check-in FROM to check-in TO.
12381235
*/
12391236
void vpatch_page(void){
12401237
const char *zFrom = P("from");
12411238
const char *zTo = P("to");
1239
+ DiffConfig DCfg;
12421240
login_check_credentials();
12431241
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
12441242
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
12451243
12461244
cgi_set_content_type("text/plain");
1247
- diff_two_versions(zFrom, zTo, 0, 0, 0, DIFF_VERBOSE, 0);
1245
+ diff_config_init(&DCfg, DIFF_VERBOSE);
1246
+ diff_two_versions(zFrom, zTo, 0, 0, 0, &DCfg, 0);
12481247
}
12491248
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -399,11 +399,11 @@
399 const char *zFile2, /* On disk content to compare to */
400 const char *zName, /* Display name of the file */
401 const char *zDiffCmd, /* Command for comparison */
402 const char *zBinGlob, /* Treat file names matching this as binary */
403 int fIncludeBinary, /* Include binary files for external diff */
404 u64 diffFlags, /* Flags to control the diff */
405 int fSwapDiff, /* Diff from Zfile2 to Pfile1 */
406 Blob *diffBlob /* Blob to store diff output */
407 ){
408 if( zDiffCmd==0 ){
409 Blob out; /* Diff output text */
@@ -418,36 +418,34 @@
418 blob_read_from_file(&file2, zFile2, ExtFILE);
419 zName2 = zName;
420 }
421
422 /* Compute and output the differences */
423 if( diffFlags & DIFF_BRIEF ){
424 if( blob_compare(pFile1, &file2) ){
425 fossil_print("CHANGED %s\n", zName);
426 }
427 }else{
428 DiffConfig DCfg;
429 diff_config_init(&DCfg, diffFlags);
430 blob_zero(&out);
431 if( fSwapDiff ){
432 text_diff(&file2, pFile1, &out, 0, &DCfg);
433 }else{
434 text_diff(pFile1, &file2, &out, 0, &DCfg);
435 }
436 if( blob_size(&out) ){
437 if( diffFlags & DIFF_NUMSTAT ){
438 if( !diffBlob ){
439 fossil_print("%s %s\n", blob_str(&out), zName);
440 }else{
441 blob_appendf(diffBlob, "%s %s\n", blob_str(&out), zName);
442 }
443 }else{
444 if( !diffBlob ){
445 diff_print_filenames(zName, zName2, diffFlags, 0);
446 fossil_print("%s\n", blob_str(&out));
447 }else{
448 diff_print_filenames(zName, zName2, diffFlags, diffBlob);
449 blob_appendf(diffBlob, "%s\n", blob_str(&out));
450 }
451 }
452 }
453 blob_reset(&out);
@@ -532,24 +530,22 @@
532 int isBin2, /* Does the 'to' content appear to be binary */
533 const char *zName, /* Display name of the file */
534 const char *zDiffCmd, /* Command for comparison */
535 const char *zBinGlob, /* Treat file names matching this as binary */
536 int fIncludeBinary, /* Include binary files for external diff */
537 u64 diffFlags /* Diff flags */
538 ){
539 if( diffFlags & DIFF_BRIEF ) return;
540 if( zDiffCmd==0 ){
541 Blob out; /* Diff output text */
542 DiffConfig DCfg;
543
544 diff_config_init(&DCfg, diffFlags);
545 blob_zero(&out);
546 text_diff(pFile1, pFile2, &out, 0, &DCfg);
547 if( diffFlags & DIFF_NUMSTAT ){
548 fossil_print("%s %s\n", blob_str(&out), zName);
549 }else{
550 diff_print_filenames(zName, zName, diffFlags, 0);
551 fossil_print("%s\n", blob_str(&out));
552 }
553
554 /* Release memory resources */
555 blob_reset(&out);
@@ -614,22 +610,22 @@
614 void diff_against_disk(
615 const char *zFrom, /* Version to difference from */
616 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
617 const char *zBinGlob, /* Treat file names matching this as binary */
618 int fIncludeBinary, /* Treat file names matching this as binary */
619 u64 diffFlags, /* Flags controlling diff output */
620 FileDirList *pFileDir, /* Which files to diff */
621 Blob *diffBlob /* Blob to output diff instead of stdout */
622 ){
623 int vid;
624 Blob sql;
625 Stmt q;
626 int asNewFile; /* Treat non-existant files as empty files */
627 int isNumStat; /* True for --numstat */
628
629 asNewFile = (diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT|DIFF_HTML))!=0;
630 isNumStat = (diffFlags & (DIFF_NUMSTAT|DIFF_TCL|DIFF_HTML))!=0;
631 vid = db_lget_int("checkout", 0);
632 vfile_check_signature(vid, CKSIG_ENOTFILE);
633 blob_zero(&sql);
634 db_begin_transaction();
635 if( zFrom ){
@@ -711,24 +707,24 @@
711 }
712 if( showDiff ){
713 Blob content;
714 int isBin;
715 if( !isLink != !file_islink(zFullName) ){
716 diff_print_index(zPathname, diffFlags, 0);
717 diff_print_filenames(zPathname, zPathname, diffFlags, 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, diffFlags, diffBlob);
728 diff_file(&content, isBin, zFullName, zPathname, zDiffCmd,
729 zBinGlob, fIncludeBinary, diffFlags, 0, diffBlob);
730 blob_reset(&content);
731 }
732 blob_reset(&fname);
733 }
734 db_finalize(&q);
@@ -747,11 +743,11 @@
747 */
748 static void diff_against_undo(
749 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
750 const char *zBinGlob, /* Treat file names matching this as binary */
751 int fIncludeBinary, /* Treat file names matching this as binary */
752 u64 diffFlags, /* Flags controlling diff output */
753 FileDirList *pFileDir /* List of files and directories to diff */
754 ){
755 Stmt q;
756 Blob content;
757 db_prepare(&q, "SELECT pathname, content FROM undo");
@@ -761,11 +757,11 @@
761 const char *zFile = (const char*)db_column_text(&q, 0);
762 if( !file_dir_match(pFileDir, zFile) ) continue;
763 zFullName = mprintf("%s%s", g.zLocalRoot, zFile);
764 db_column_blob(&q, 1, &content);
765 diff_file(&content, 0, zFullName, zFile,
766 zDiffCmd, zBinGlob, fIncludeBinary, diffFlags, 0, 0);
767 fossil_free(zFullName);
768 blob_reset(&content);
769 }
770 db_finalize(&q);
771 }
@@ -785,11 +781,11 @@
785 struct ManifestFile *pFrom,
786 struct ManifestFile *pTo,
787 const char *zDiffCmd,
788 const char *zBinGlob,
789 int fIncludeBinary,
790 u64 diffFlags
791 ){
792 Blob f1, f2;
793 int isBin1, isBin2;
794 int rid;
795 const char *zName;
@@ -798,12 +794,12 @@
798 }else if( pTo ){
799 zName = pTo->zName;
800 }else{
801 zName = DIFF_NO_NAME;
802 }
803 if( diffFlags & DIFF_BRIEF ) return;
804 diff_print_index(zName, diffFlags, 0);
805 if( pFrom ){
806 rid = uuid_to_rid(pFrom->zUuid, 0);
807 content_get(rid, &f1);
808 }else{
809 blob_zero(&f1);
@@ -815,11 +811,11 @@
815 blob_zero(&f2);
816 }
817 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&f1);
818 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&f2);
819 diff_file_mem(&f1, &f2, isBin1, isBin2, zName, zDiffCmd,
820 zBinGlob, fIncludeBinary, diffFlags);
821 blob_reset(&f1);
822 blob_reset(&f2);
823 }
824
825 /*
@@ -836,16 +832,16 @@
836 const char *zFrom,
837 const char *zTo,
838 const char *zDiffCmd,
839 const char *zBinGlob,
840 int fIncludeBinary,
841 u64 diffFlags,
842 FileDirList *pFileDir
843 ){
844 Manifest *pFrom, *pTo;
845 ManifestFile *pFromFile, *pToFile;
846 int asNewFlag = (diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT))!=0 ? 1 : 0;
847
848 pFrom = manifest_get_by_name(zFrom, 0);
849 manifest_file_rewind(pFrom);
850 pFromFile = manifest_file_next(pFrom,0);
851 pTo = manifest_get_by_name(zTo, 0);
@@ -861,27 +857,28 @@
861 }else{
862 cmp = fossil_strcmp(pFromFile->zName, pToFile->zName);
863 }
864 if( cmp<0 ){
865 if( file_dir_match(pFileDir, pFromFile->zName) ){
866 if( (diffFlags & (DIFF_NUMSTAT|DIFF_HTML))==0 ){
867 fossil_print("DELETED %s\n", pFromFile->zName);
868 }
869 if( asNewFlag ){
870 diff_manifest_entry(pFromFile, 0, zDiffCmd, zBinGlob,
871 fIncludeBinary, diffFlags);
872 }
873 }
874 pFromFile = manifest_file_next(pFrom,0);
875 }else if( cmp>0 ){
876 if( file_dir_match(pFileDir, pToFile->zName) ){
877 if( (diffFlags & (DIFF_NUMSTAT|DIFF_HTML|DIFF_TCL|DIFF_JSON))==0 ){
 
878 fossil_print("ADDED %s\n", pToFile->zName);
879 }
880 if( asNewFlag ){
881 diff_manifest_entry(0, pToFile, zDiffCmd, zBinGlob,
882 fIncludeBinary, diffFlags);
883 }
884 }
885 pToFile = manifest_file_next(pTo,0);
886 }else if( fossil_strcmp(pFromFile->zUuid, pToFile->zUuid)==0 ){
887 /* No changes */
@@ -888,15 +885,15 @@
888 (void)file_dir_match(pFileDir, pFromFile->zName); /* Record name usage */
889 pFromFile = manifest_file_next(pFrom,0);
890 pToFile = manifest_file_next(pTo,0);
891 }else{
892 if( file_dir_match(pFileDir, pToFile->zName) ){
893 if( diffFlags & DIFF_BRIEF ){
894 fossil_print("CHANGED %s\n", pFromFile->zName);
895 }else{
896 diff_manifest_entry(pFromFile, pToFile, zDiffCmd, zBinGlob,
897 fIncludeBinary, diffFlags);
898 }
899 }
900 pFromFile = manifest_file_next(pFrom,0);
901 pToFile = manifest_file_next(pTo,0);
902 }
@@ -1200,17 +1197,17 @@
1200 if( db_lget_int("undo_available",0)==0 ){
1201 fossil_print("No undo or redo is available\n");
1202 return;
1203 }
1204 diff_against_undo(zDiffCmd, zBinGlob, fIncludeBinary,
1205 DCfg.diffFlags, pFileDir);
1206 }else if( zTo==0 ){
1207 diff_against_disk(zFrom, zDiffCmd, zBinGlob, fIncludeBinary,
1208 DCfg.diffFlags, pFileDir, 0);
1209 }else{
1210 diff_two_versions(zFrom, zTo, zDiffCmd, zBinGlob, fIncludeBinary,
1211 DCfg.diffFlags, pFileDir);
1212 }
1213 if( pFileDir ){
1214 int i;
1215 for(i=0; pFileDir[i].zName; i++){
1216 if( pFileDir[i].nUsed==0
@@ -1237,12 +1234,14 @@
1237 ** Show a patch that goes from check-in FROM to check-in TO.
1238 */
1239 void vpatch_page(void){
1240 const char *zFrom = P("from");
1241 const char *zTo = P("to");
 
1242 login_check_credentials();
1243 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1244 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
1245
1246 cgi_set_content_type("text/plain");
1247 diff_two_versions(zFrom, zTo, 0, 0, 0, DIFF_VERBOSE, 0);
 
1248 }
1249
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -399,11 +399,11 @@
399 const char *zFile2, /* On disk content to compare to */
400 const char *zName, /* Display name of the file */
401 const char *zDiffCmd, /* Command for comparison */
402 const char *zBinGlob, /* Treat file names matching this as binary */
403 int fIncludeBinary, /* Include binary files for external diff */
404 DiffConfig *pCfg, /* Flags to control the diff */
405 int fSwapDiff, /* Diff from Zfile2 to Pfile1 */
406 Blob *diffBlob /* Blob to store diff output */
407 ){
408 if( zDiffCmd==0 ){
409 Blob out; /* Diff output text */
@@ -418,36 +418,34 @@
418 blob_read_from_file(&file2, zFile2, ExtFILE);
419 zName2 = zName;
420 }
421
422 /* Compute and output the differences */
423 if( pCfg->diffFlags & DIFF_BRIEF ){
424 if( blob_compare(pFile1, &file2) ){
425 fossil_print("CHANGED %s\n", zName);
426 }
427 }else{
 
 
428 blob_zero(&out);
429 if( fSwapDiff ){
430 text_diff(&file2, pFile1, &out, 0, pCfg);
431 }else{
432 text_diff(pFile1, &file2, &out, 0, pCfg);
433 }
434 if( blob_size(&out) ){
435 if( pCfg->diffFlags & DIFF_NUMSTAT ){
436 if( !diffBlob ){
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);
@@ -532,24 +530,22 @@
530 int isBin2, /* Does the 'to' content appear to be binary */
531 const char *zName, /* Display name of the file */
532 const char *zDiffCmd, /* Command for comparison */
533 const char *zBinGlob, /* Treat file names matching this as binary */
534 int fIncludeBinary, /* Include binary files for external diff */
535 DiffConfig *pCfg /* Diff flags */
536 ){
537 if( pCfg->diffFlags & DIFF_BRIEF ) return;
538 if( zDiffCmd==0 ){
539 Blob out; /* Diff output text */
 
540
 
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);
@@ -614,22 +610,22 @@
610 void diff_against_disk(
611 const char *zFrom, /* Version to difference from */
612 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
613 const char *zBinGlob, /* Treat file names matching this as binary */
614 int fIncludeBinary, /* Treat file names matching this as binary */
615 DiffConfig *pCfg, /* Flags controlling diff output */
616 FileDirList *pFileDir, /* Which files to diff */
617 Blob *diffBlob /* Blob to output diff instead of stdout */
618 ){
619 int vid;
620 Blob sql;
621 Stmt q;
622 int asNewFile; /* Treat non-existant files as empty files */
623 int isNumStat; /* True for --numstat */
624
625 asNewFile = (pCfg->diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT|DIFF_HTML))!=0;
626 isNumStat = (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_TCL|DIFF_HTML))!=0;
627 vid = db_lget_int("checkout", 0);
628 vfile_check_signature(vid, CKSIG_ENOTFILE);
629 blob_zero(&sql);
630 db_begin_transaction();
631 if( zFrom ){
@@ -711,24 +707,24 @@
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);
729 }
730 db_finalize(&q);
@@ -747,11 +743,11 @@
743 */
744 static void diff_against_undo(
745 const char *zDiffCmd, /* Use this diff command. NULL for built-in */
746 const char *zBinGlob, /* Treat file names matching this as binary */
747 int fIncludeBinary, /* Treat file names matching this as binary */
748 DiffConfig *pCfg, /* Flags controlling diff output */
749 FileDirList *pFileDir /* List of files and directories to diff */
750 ){
751 Stmt q;
752 Blob content;
753 db_prepare(&q, "SELECT pathname, content FROM undo");
@@ -761,11 +757,11 @@
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, 0, zFullName, zFile,
762 zDiffCmd, zBinGlob, fIncludeBinary, pCfg, 0, 0);
763 fossil_free(zFullName);
764 blob_reset(&content);
765 }
766 db_finalize(&q);
767 }
@@ -785,11 +781,11 @@
781 struct ManifestFile *pFrom,
782 struct ManifestFile *pTo,
783 const char *zDiffCmd,
784 const char *zBinGlob,
785 int fIncludeBinary,
786 DiffConfig *pCfg
787 ){
788 Blob f1, f2;
789 int isBin1, isBin2;
790 int rid;
791 const char *zName;
@@ -798,12 +794,12 @@
794 }else if( pTo ){
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);
@@ -815,11 +811,11 @@
811 blob_zero(&f2);
812 }
813 isBin1 = fIncludeBinary ? 0 : looks_like_binary(&f1);
814 isBin2 = fIncludeBinary ? 0 : looks_like_binary(&f2);
815 diff_file_mem(&f1, &f2, isBin1, isBin2, zName, zDiffCmd,
816 zBinGlob, fIncludeBinary, pCfg);
817 blob_reset(&f1);
818 blob_reset(&f2);
819 }
820
821 /*
@@ -836,16 +832,16 @@
832 const char *zFrom,
833 const char *zTo,
834 const char *zDiffCmd,
835 const char *zBinGlob,
836 int fIncludeBinary,
837 DiffConfig *pCfg,
838 FileDirList *pFileDir
839 ){
840 Manifest *pFrom, *pTo;
841 ManifestFile *pFromFile, *pToFile;
842 int asNewFlag = (pCfg->diffFlags & (DIFF_VERBOSE|DIFF_NUMSTAT))!=0 ? 1 : 0;
843
844 pFrom = manifest_get_by_name(zFrom, 0);
845 manifest_file_rewind(pFrom);
846 pFromFile = manifest_file_next(pFrom,0);
847 pTo = manifest_get_by_name(zTo, 0);
@@ -861,27 +857,28 @@
857 }else{
858 cmp = fossil_strcmp(pFromFile->zName, pToFile->zName);
859 }
860 if( cmp<0 ){
861 if( file_dir_match(pFileDir, pFromFile->zName) ){
862 if( (pCfg->diffFlags & (DIFF_NUMSTAT|DIFF_HTML))==0 ){
863 fossil_print("DELETED %s\n", pFromFile->zName);
864 }
865 if( asNewFlag ){
866 diff_manifest_entry(pFromFile, 0, zDiffCmd, zBinGlob,
867 fIncludeBinary, pCfg);
868 }
869 }
870 pFromFile = manifest_file_next(pFrom,0);
871 }else if( cmp>0 ){
872 if( file_dir_match(pFileDir, pToFile->zName) ){
873 if( (pCfg->diffFlags &
874 (DIFF_NUMSTAT|DIFF_HTML|DIFF_TCL|DIFF_JSON))==0 ){
875 fossil_print("ADDED %s\n", pToFile->zName);
876 }
877 if( asNewFlag ){
878 diff_manifest_entry(0, pToFile, zDiffCmd, zBinGlob,
879 fIncludeBinary, pCfg);
880 }
881 }
882 pToFile = manifest_file_next(pTo,0);
883 }else if( fossil_strcmp(pFromFile->zUuid, pToFile->zUuid)==0 ){
884 /* No changes */
@@ -888,15 +885,15 @@
885 (void)file_dir_match(pFileDir, pFromFile->zName); /* Record name usage */
886 pFromFile = manifest_file_next(pFrom,0);
887 pToFile = manifest_file_next(pTo,0);
888 }else{
889 if( file_dir_match(pFileDir, pToFile->zName) ){
890 if( pCfg->diffFlags & DIFF_BRIEF ){
891 fossil_print("CHANGED %s\n", pFromFile->zName);
892 }else{
893 diff_manifest_entry(pFromFile, pToFile, zDiffCmd, zBinGlob,
894 fIncludeBinary, pCfg);
895 }
896 }
897 pFromFile = manifest_file_next(pFrom,0);
898 pToFile = manifest_file_next(pTo,0);
899 }
@@ -1200,17 +1197,17 @@
1197 if( db_lget_int("undo_available",0)==0 ){
1198 fossil_print("No undo or redo is available\n");
1199 return;
1200 }
1201 diff_against_undo(zDiffCmd, zBinGlob, fIncludeBinary,
1202 &DCfg, pFileDir);
1203 }else if( zTo==0 ){
1204 diff_against_disk(zFrom, zDiffCmd, zBinGlob, fIncludeBinary,
1205 &DCfg, pFileDir, 0);
1206 }else{
1207 diff_two_versions(zFrom, zTo, zDiffCmd, zBinGlob, fIncludeBinary,
1208 &DCfg, pFileDir);
1209 }
1210 if( pFileDir ){
1211 int i;
1212 for(i=0; pFileDir[i].zName; i++){
1213 if( pFileDir[i].nUsed==0
@@ -1237,12 +1234,14 @@
1234 ** Show a patch that goes from check-in FROM to check-in TO.
1235 */
1236 void vpatch_page(void){
1237 const char *zFrom = P("from");
1238 const char *zTo = P("to");
1239 DiffConfig DCfg;
1240 login_check_credentials();
1241 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1242 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
1243
1244 cgi_set_content_type("text/plain");
1245 diff_config_init(&DCfg, DIFF_VERBOSE);
1246 diff_two_versions(zFrom, zTo, 0, 0, 0, &DCfg, 0);
1247 }
1248
+3 -3
--- src/patch.c
+++ src/patch.c
@@ -809,20 +809,20 @@
809809
diff_print_index(zName, pCfg->diffFlags, 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,
814
- zBinGlob, fIncludeBinary, pCfg->diffFlags);
814
+ 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);
819819
diff_print_index(zName, pCfg->diffFlags, 0);
820820
isBin1 = 0;
821821
isBin2 = fIncludeBinary ? 0 : looks_like_binary(&a);
822822
diff_file_mem(&empty, &a, isBin1, isBin2, zName, zDiffCmd,
823
- zBinGlob, fIncludeBinary, pCfg->diffFlags);
823
+ zBinGlob, fIncludeBinary, pCfg);
824824
blob_reset(&a);
825825
}else if( db_column_bytes(&q, 3)>0 ){
826826
Blob delta;
827827
db_ephemeral_blob(&q, 3, &delta);
828828
blob_uncompress(&delta, &delta);
@@ -829,11 +829,11 @@
829829
content_get(rid, &a);
830830
blob_delta_apply(&a, &delta, &b);
831831
isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
832832
isBin2 = fIncludeBinary ? 0 : looks_like_binary(&b);
833833
diff_file_mem(&a, &b, isBin1, isBin2, zName,
834
- zDiffCmd, zBinGlob, fIncludeBinary, pCfg->diffFlags);
834
+ zDiffCmd, zBinGlob, fIncludeBinary, pCfg);
835835
blob_reset(&a);
836836
blob_reset(&b);
837837
blob_reset(&delta);
838838
}
839839
}
840840
--- src/patch.c
+++ src/patch.c
@@ -809,20 +809,20 @@
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->diffFlags);
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->diffFlags);
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,11 +829,11 @@
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->diffFlags);
835 blob_reset(&a);
836 blob_reset(&b);
837 blob_reset(&delta);
838 }
839 }
840
--- src/patch.c
+++ src/patch.c
@@ -809,20 +809,20 @@
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);
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,11 +829,11 @@
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 }
840
+4 -4
--- src/stash.c
+++ src/stash.c
@@ -434,20 +434,20 @@
434434
if( !bWebpage ) fossil_print("ADDED %s\n", zNew);
435435
diff_print_index(zNew, pCfg->diffFlags, 0);
436436
isBin1 = 0;
437437
isBin2 = fIncludeBinary ? 0 : looks_like_binary(&a);
438438
diff_file_mem(&empty, &a, isBin1, isBin2, zNew, zDiffCmd,
439
- zBinGlob, fIncludeBinary, pCfg->diffFlags);
439
+ zBinGlob, fIncludeBinary, pCfg);
440440
}else if( isRemoved ){
441441
if( !bWebpage) fossil_print("DELETE %s\n", zOrig);
442442
diff_print_index(zNew, pCfg->diffFlags, 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,
448
- zBinGlob, fIncludeBinary, pCfg->diffFlags);
448
+ zBinGlob, fIncludeBinary, pCfg);
449449
}
450450
}else{
451451
Blob delta;
452452
int isOrigLink = file_islink(zOPath);
453453
db_ephemeral_blob(&q, 6, &delta);
@@ -461,16 +461,16 @@
461461
blob_delta_apply(&a, &delta, &b);
462462
isBin1 = fIncludeBinary ? 0 : looks_like_binary(&a);
463463
isBin2 = fIncludeBinary ? 0 : looks_like_binary(&b);
464464
if( fBaseline ){
465465
diff_file_mem(&a, &b, isBin1, isBin2, zNew,
466
- zDiffCmd, zBinGlob, fIncludeBinary, pCfg->diffFlags);
466
+ zDiffCmd, zBinGlob, fIncludeBinary, pCfg);
467467
}else{
468468
/*Diff with file on disk using fSwapDiff=1 to show the diff in the
469469
same direction as if fBaseline=1.*/
470470
diff_file(&b, isBin2, zOPath, zNew, zDiffCmd,
471
- zBinGlob, fIncludeBinary, pCfg->diffFlags, 1, 0);
471
+ zBinGlob, fIncludeBinary, pCfg, 1, 0);
472472
}
473473
blob_reset(&a);
474474
blob_reset(&b);
475475
}
476476
blob_reset(&delta);
477477
--- src/stash.c
+++ src/stash.c
@@ -434,20 +434,20 @@
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->diffFlags);
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,
448 zBinGlob, fIncludeBinary, pCfg->diffFlags);
449 }
450 }else{
451 Blob delta;
452 int isOrigLink = file_islink(zOPath);
453 db_ephemeral_blob(&q, 6, &delta);
@@ -461,16 +461,16 @@
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->diffFlags);
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->diffFlags, 1, 0);
472 }
473 blob_reset(&a);
474 blob_reset(&b);
475 }
476 blob_reset(&delta);
477
--- src/stash.c
+++ src/stash.c
@@ -434,20 +434,20 @@
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,
448 zBinGlob, fIncludeBinary, pCfg);
449 }
450 }else{
451 Blob delta;
452 int isOrigLink = file_islink(zOPath);
453 db_ephemeral_blob(&q, 6, &delta);
@@ -461,16 +461,16 @@
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);
477

Keyboard Shortcuts

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