Fossil SCM

After fossil rm, do not read content from disk with fossil diff. This way, fossil diff output reflects what would be committed.

preben 2023-10-05 12:17 diff-deleted-files
Commit e93797317ddcc568ed739a72906c040ca5b7a894124189278099114d02188db1
1 file changed +5 -2
+5 -2
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -441,11 +441,11 @@
441441
Blob file2; /* Content of zFile2 */
442442
const char *zName2; /* Name of zFile2 for display */
443443
444444
/* Read content of zFile2 into memory */
445445
blob_zero(&file2);
446
- if( file_size(zFile2, ExtFILE)<0 ){
446
+ if( pCfg->diffFlags & DIFF_FILE_DELETED || file_size(zFile2, ExtFILE)<0 ){
447447
zName2 = NULL_DEVICE;
448448
}else{
449449
blob_read_from_file(&file2, zFile2, ExtFILE);
450450
zName2 = zName;
451451
}
@@ -754,11 +754,14 @@
754754
if( srcid>0 ){
755755
content_get(srcid, &content);
756756
}else{
757757
blob_zero(&content);
758758
}
759
- if( isChnged==0 || !file_same_as_blob(&content, zFullName) ){
759
+ if( isChnged==0
760
+ || pCfg->diffFlags & DIFF_FILE_DELETED
761
+ || !file_same_as_blob(&content, zFullName)
762
+ ){
760763
diff_print_index(zPathname, pCfg, pOut);
761764
diff_file(&content, zFullName, zPathname, pCfg, pOut);
762765
}
763766
blob_reset(&content);
764767
}
765768
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -441,11 +441,11 @@
441 Blob file2; /* Content of zFile2 */
442 const char *zName2; /* Name of zFile2 for display */
443
444 /* Read content of zFile2 into memory */
445 blob_zero(&file2);
446 if( file_size(zFile2, ExtFILE)<0 ){
447 zName2 = NULL_DEVICE;
448 }else{
449 blob_read_from_file(&file2, zFile2, ExtFILE);
450 zName2 = zName;
451 }
@@ -754,11 +754,14 @@
754 if( srcid>0 ){
755 content_get(srcid, &content);
756 }else{
757 blob_zero(&content);
758 }
759 if( isChnged==0 || !file_same_as_blob(&content, zFullName) ){
 
 
 
760 diff_print_index(zPathname, pCfg, pOut);
761 diff_file(&content, zFullName, zPathname, pCfg, pOut);
762 }
763 blob_reset(&content);
764 }
765
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -441,11 +441,11 @@
441 Blob file2; /* Content of zFile2 */
442 const char *zName2; /* Name of zFile2 for display */
443
444 /* Read content of zFile2 into memory */
445 blob_zero(&file2);
446 if( pCfg->diffFlags & DIFF_FILE_DELETED || file_size(zFile2, ExtFILE)<0 ){
447 zName2 = NULL_DEVICE;
448 }else{
449 blob_read_from_file(&file2, zFile2, ExtFILE);
450 zName2 = zName;
451 }
@@ -754,11 +754,14 @@
754 if( srcid>0 ){
755 content_get(srcid, &content);
756 }else{
757 blob_zero(&content);
758 }
759 if( isChnged==0
760 || pCfg->diffFlags & DIFF_FILE_DELETED
761 || !file_same_as_blob(&content, zFullName)
762 ){
763 diff_print_index(zPathname, pCfg, pOut);
764 diff_file(&content, zFullName, zPathname, pCfg, pOut);
765 }
766 blob_reset(&content);
767 }
768

Keyboard Shortcuts

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