Fossil SCM
Fix issues with the --brief option to the diff command.
Commit
fbaa7ca99f79bdfbbd08f5a45930d55876973ed3
Parent
3e3feb2dda2c950…
1 file changed
+13
-11
+13
-11
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -68,11 +68,10 @@ | ||
| 68 | 68 | const char *zFile2, /* On disk content to compare to */ |
| 69 | 69 | const char *zName, /* Display name of the file */ |
| 70 | 70 | const char *zDiffCmd, /* Command for comparison */ |
| 71 | 71 | int diffFlags /* Flags to control the diff */ |
| 72 | 72 | ){ |
| 73 | - if( diffFlags & DIFF_BRIEF ) return; | |
| 74 | 73 | if( zDiffCmd==0 ){ |
| 75 | 74 | Blob out; /* Diff output text */ |
| 76 | 75 | Blob file2; /* Content of zFile2 */ |
| 77 | 76 | const char *zName2; /* Name of zFile2 for display */ |
| 78 | 77 | |
| @@ -88,20 +87,26 @@ | ||
| 88 | 87 | } |
| 89 | 88 | zName2 = zName; |
| 90 | 89 | } |
| 91 | 90 | |
| 92 | 91 | /* 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); | |
| 98 | 104 | } |
| 99 | 105 | |
| 100 | 106 | /* Release memory resources */ |
| 101 | 107 | blob_reset(&file2); |
| 102 | - blob_reset(&out); | |
| 103 | 108 | }else{ |
| 104 | 109 | int cnt = 0; |
| 105 | 110 | Blob nameFile1; /* Name of temporary file to old pFile1 content */ |
| 106 | 111 | Blob cmd; /* Text of command to run */ |
| 107 | 112 | |
| @@ -197,11 +202,10 @@ | ||
| 197 | 202 | const char *zFileTreeName |
| 198 | 203 | ){ |
| 199 | 204 | Blob fname; |
| 200 | 205 | Blob content; |
| 201 | 206 | int isLink; |
| 202 | - if( diffFlags & DIFF_BRIEF ) return; | |
| 203 | 207 | file_tree_name(zFileTreeName, &fname, 1); |
| 204 | 208 | historical_version_of_file(zFrom, blob_str(&fname), &content, &isLink, 0, 0); |
| 205 | 209 | if( !isLink != !file_wd_islink(zFrom) ){ |
| 206 | 210 | fossil_print("cannot compute difference between " |
| 207 | 211 | "symlink and regular file\n"); |
| @@ -292,13 +296,11 @@ | ||
| 292 | 296 | }else if( isChnged==3 ){ |
| 293 | 297 | fossil_print("ADDED_BY_MERGE %s\n", zPathname); |
| 294 | 298 | srcid = 0; |
| 295 | 299 | if( !asNewFile ){ showDiff = 0; } |
| 296 | 300 | } |
| 297 | - if( diffFlags & DIFF_BRIEF ){ | |
| 298 | - if( showDiff ) fossil_print("CHANGED %s\n", zPathname); | |
| 299 | - }else if( showDiff ){ | |
| 301 | + if( showDiff ){ | |
| 300 | 302 | Blob content; |
| 301 | 303 | if( !isLink != !file_wd_islink(zFullName) ){ |
| 302 | 304 | diff_print_index(zPathname, diffFlags); |
| 303 | 305 | diff_print_filenames(zPathname, zPathname, diffFlags); |
| 304 | 306 | fossil_print("cannot compute difference between " |
| 305 | 307 |
| --- 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 |