Fossil SCM

Fix issues with the --brief option to the diff command.

drh 2012-02-08 00:34 trunk
Commit fbaa7ca99f79bdfbbd08f5a45930d55876973ed3
1 file changed +13 -11
+13 -11
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -68,11 +68,10 @@
6868
const char *zFile2, /* On disk content to compare to */
6969
const char *zName, /* Display name of the file */
7070
const char *zDiffCmd, /* Command for comparison */
7171
int diffFlags /* Flags to control the diff */
7272
){
73
- if( diffFlags & DIFF_BRIEF ) return;
7473
if( zDiffCmd==0 ){
7574
Blob out; /* Diff output text */
7675
Blob file2; /* Content of zFile2 */
7776
const char *zName2; /* Name of zFile2 for display */
7877
@@ -88,20 +87,26 @@
8887
}
8988
zName2 = zName;
9089
}
9190
9291
/* Compute and output the differences */
93
- blob_zero(&out);
94
- text_diff(pFile1, &file2, &out, diffFlags);
95
- if( blob_size(&out) ){
96
- diff_print_filenames(zName, zName2, diffFlags);
97
- fossil_print("%s\n", blob_str(&out));
92
+ if( diffFlags & DIFF_BRIEF ){
93
+ if( blob_compare(pFile1, &file2) ){
94
+ fossil_print("CHANGED %s\n", zName);
95
+ }
96
+ }else{
97
+ blob_zero(&out);
98
+ text_diff(pFile1, &file2, &out, diffFlags);
99
+ if( blob_size(&out) ){
100
+ diff_print_filenames(zName, zName2, diffFlags);
101
+ fossil_print("%s\n", blob_str(&out));
102
+ }
103
+ blob_reset(&out);
98104
}
99105
100106
/* Release memory resources */
101107
blob_reset(&file2);
102
- blob_reset(&out);
103108
}else{
104109
int cnt = 0;
105110
Blob nameFile1; /* Name of temporary file to old pFile1 content */
106111
Blob cmd; /* Text of command to run */
107112
@@ -197,11 +202,10 @@
197202
const char *zFileTreeName
198203
){
199204
Blob fname;
200205
Blob content;
201206
int isLink;
202
- if( diffFlags & DIFF_BRIEF ) return;
203207
file_tree_name(zFileTreeName, &fname, 1);
204208
historical_version_of_file(zFrom, blob_str(&fname), &content, &isLink, 0, 0);
205209
if( !isLink != !file_wd_islink(zFrom) ){
206210
fossil_print("cannot compute difference between "
207211
"symlink and regular file\n");
@@ -292,13 +296,11 @@
292296
}else if( isChnged==3 ){
293297
fossil_print("ADDED_BY_MERGE %s\n", zPathname);
294298
srcid = 0;
295299
if( !asNewFile ){ showDiff = 0; }
296300
}
297
- if( diffFlags & DIFF_BRIEF ){
298
- if( showDiff ) fossil_print("CHANGED %s\n", zPathname);
299
- }else if( showDiff ){
301
+ if( showDiff ){
300302
Blob content;
301303
if( !isLink != !file_wd_islink(zFullName) ){
302304
diff_print_index(zPathname, diffFlags);
303305
diff_print_filenames(zPathname, zPathname, diffFlags);
304306
fossil_print("cannot compute difference between "
305307
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -68,11 +68,10 @@
68 const char *zFile2, /* On disk content to compare to */
69 const char *zName, /* Display name of the file */
70 const char *zDiffCmd, /* Command for comparison */
71 int diffFlags /* Flags to control the diff */
72 ){
73 if( diffFlags & DIFF_BRIEF ) return;
74 if( zDiffCmd==0 ){
75 Blob out; /* Diff output text */
76 Blob file2; /* Content of zFile2 */
77 const char *zName2; /* Name of zFile2 for display */
78
@@ -88,20 +87,26 @@
88 }
89 zName2 = zName;
90 }
91
92 /* Compute and output the differences */
93 blob_zero(&out);
94 text_diff(pFile1, &file2, &out, diffFlags);
95 if( blob_size(&out) ){
96 diff_print_filenames(zName, zName2, diffFlags);
97 fossil_print("%s\n", blob_str(&out));
 
 
 
 
 
 
 
98 }
99
100 /* Release memory resources */
101 blob_reset(&file2);
102 blob_reset(&out);
103 }else{
104 int cnt = 0;
105 Blob nameFile1; /* Name of temporary file to old pFile1 content */
106 Blob cmd; /* Text of command to run */
107
@@ -197,11 +202,10 @@
197 const char *zFileTreeName
198 ){
199 Blob fname;
200 Blob content;
201 int isLink;
202 if( diffFlags & DIFF_BRIEF ) return;
203 file_tree_name(zFileTreeName, &fname, 1);
204 historical_version_of_file(zFrom, blob_str(&fname), &content, &isLink, 0, 0);
205 if( !isLink != !file_wd_islink(zFrom) ){
206 fossil_print("cannot compute difference between "
207 "symlink and regular file\n");
@@ -292,13 +296,11 @@
292 }else if( isChnged==3 ){
293 fossil_print("ADDED_BY_MERGE %s\n", zPathname);
294 srcid = 0;
295 if( !asNewFile ){ showDiff = 0; }
296 }
297 if( diffFlags & DIFF_BRIEF ){
298 if( showDiff ) fossil_print("CHANGED %s\n", zPathname);
299 }else if( showDiff ){
300 Blob content;
301 if( !isLink != !file_wd_islink(zFullName) ){
302 diff_print_index(zPathname, diffFlags);
303 diff_print_filenames(zPathname, zPathname, diffFlags);
304 fossil_print("cannot compute difference between "
305
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -68,11 +68,10 @@
68 const char *zFile2, /* On disk content to compare to */
69 const char *zName, /* Display name of the file */
70 const char *zDiffCmd, /* Command for comparison */
71 int diffFlags /* Flags to control the diff */
72 ){
 
73 if( zDiffCmd==0 ){
74 Blob out; /* Diff output text */
75 Blob file2; /* Content of zFile2 */
76 const char *zName2; /* Name of zFile2 for display */
77
@@ -88,20 +87,26 @@
87 }
88 zName2 = zName;
89 }
90
91 /* Compute and output the differences */
92 if( diffFlags & DIFF_BRIEF ){
93 if( blob_compare(pFile1, &file2) ){
94 fossil_print("CHANGED %s\n", zName);
95 }
96 }else{
97 blob_zero(&out);
98 text_diff(pFile1, &file2, &out, diffFlags);
99 if( blob_size(&out) ){
100 diff_print_filenames(zName, zName2, diffFlags);
101 fossil_print("%s\n", blob_str(&out));
102 }
103 blob_reset(&out);
104 }
105
106 /* Release memory resources */
107 blob_reset(&file2);
 
108 }else{
109 int cnt = 0;
110 Blob nameFile1; /* Name of temporary file to old pFile1 content */
111 Blob cmd; /* Text of command to run */
112
@@ -197,11 +202,10 @@
202 const char *zFileTreeName
203 ){
204 Blob fname;
205 Blob content;
206 int isLink;
 
207 file_tree_name(zFileTreeName, &fname, 1);
208 historical_version_of_file(zFrom, blob_str(&fname), &content, &isLink, 0, 0);
209 if( !isLink != !file_wd_islink(zFrom) ){
210 fossil_print("cannot compute difference between "
211 "symlink and regular file\n");
@@ -292,13 +296,11 @@
296 }else if( isChnged==3 ){
297 fossil_print("ADDED_BY_MERGE %s\n", zPathname);
298 srcid = 0;
299 if( !asNewFile ){ showDiff = 0; }
300 }
301 if( showDiff ){
 
 
302 Blob content;
303 if( !isLink != !file_wd_islink(zFullName) ){
304 diff_print_index(zPathname, diffFlags);
305 diff_print_filenames(zPathname, zPathname, diffFlags);
306 fossil_print("cannot compute difference between "
307

Keyboard Shortcuts

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