Fossil SCM
Add an "unprotect()" call to /ckout so that it can see that files have changed and update the vfile table appropriately. Updates to diff command-line parser comments to mention all the latest options.
Commit
a2a0390cbf7df9a707766d7593d67d68b4a33bbb627cec03612984f96832974b
Parent
d35d201840d9bef…
3 files changed
+9
+3
-3
+2
+9
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -3227,20 +3227,29 @@ | ||
| 3227 | 3227 | ** Initialize the DiffConfig object using command-line options. |
| 3228 | 3228 | ** |
| 3229 | 3229 | ** Process diff-related command-line options and return an appropriate |
| 3230 | 3230 | ** "diffFlags" integer. |
| 3231 | 3231 | ** |
| 3232 | +** -b|--browser Show the diff output in a web-browser | |
| 3232 | 3233 | ** --brief Show filenames only DIFF_BRIEF |
| 3234 | +** --by Shorthand for "--browser -y" | |
| 3233 | 3235 | ** -c|--context N N lines of context. nContext |
| 3236 | +** --dark Use dark mode for Tcl/Tk and HTML output | |
| 3234 | 3237 | ** --html Format for HTML DIFF_HTML |
| 3238 | +** -i|--internal Use built-in diff, not an external tool | |
| 3235 | 3239 | ** --invert Invert the diff DIFF_INVERT |
| 3240 | +** --json Output formatted as JSON | |
| 3236 | 3241 | ** -n|--linenum Show line numbers DIFF_LINENO |
| 3242 | +** -N|--new-file Alias for --verbose | |
| 3237 | 3243 | ** --noopt Disable optimization DIFF_NOOPT |
| 3238 | 3244 | ** --numstat Show change counts DIFF_NUMSTAT |
| 3239 | 3245 | ** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR |
| 3246 | +** --tcl Tcl-formatted output used internally by --tk | |
| 3240 | 3247 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 3248 | +** -v|--verbose Show complete text of added or deleted files | |
| 3241 | 3249 | ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS |
| 3250 | +** --webpage Format output as a stand-alone HTML webpage | |
| 3242 | 3251 | ** -W|--width N N character lines. wColumn |
| 3243 | 3252 | ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE |
| 3244 | 3253 | ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS |
| 3245 | 3254 | */ |
| 3246 | 3255 | void diff_options(DiffConfig *pCfg, int isGDiff, int bUnifiedTextOnly){ |
| 3247 | 3256 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -3227,20 +3227,29 @@ | |
| 3227 | ** Initialize the DiffConfig object using command-line options. |
| 3228 | ** |
| 3229 | ** Process diff-related command-line options and return an appropriate |
| 3230 | ** "diffFlags" integer. |
| 3231 | ** |
| 3232 | ** --brief Show filenames only DIFF_BRIEF |
| 3233 | ** -c|--context N N lines of context. nContext |
| 3234 | ** --html Format for HTML DIFF_HTML |
| 3235 | ** --invert Invert the diff DIFF_INVERT |
| 3236 | ** -n|--linenum Show line numbers DIFF_LINENO |
| 3237 | ** --noopt Disable optimization DIFF_NOOPT |
| 3238 | ** --numstat Show change counts DIFF_NUMSTAT |
| 3239 | ** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR |
| 3240 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 3241 | ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS |
| 3242 | ** -W|--width N N character lines. wColumn |
| 3243 | ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE |
| 3244 | ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS |
| 3245 | */ |
| 3246 | void diff_options(DiffConfig *pCfg, int isGDiff, int bUnifiedTextOnly){ |
| 3247 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -3227,20 +3227,29 @@ | |
| 3227 | ** Initialize the DiffConfig object using command-line options. |
| 3228 | ** |
| 3229 | ** Process diff-related command-line options and return an appropriate |
| 3230 | ** "diffFlags" integer. |
| 3231 | ** |
| 3232 | ** -b|--browser Show the diff output in a web-browser |
| 3233 | ** --brief Show filenames only DIFF_BRIEF |
| 3234 | ** --by Shorthand for "--browser -y" |
| 3235 | ** -c|--context N N lines of context. nContext |
| 3236 | ** --dark Use dark mode for Tcl/Tk and HTML output |
| 3237 | ** --html Format for HTML DIFF_HTML |
| 3238 | ** -i|--internal Use built-in diff, not an external tool |
| 3239 | ** --invert Invert the diff DIFF_INVERT |
| 3240 | ** --json Output formatted as JSON |
| 3241 | ** -n|--linenum Show line numbers DIFF_LINENO |
| 3242 | ** -N|--new-file Alias for --verbose |
| 3243 | ** --noopt Disable optimization DIFF_NOOPT |
| 3244 | ** --numstat Show change counts DIFF_NUMSTAT |
| 3245 | ** --strip-trailing-cr Strip trailing CR DIFF_STRIP_EOLCR |
| 3246 | ** --tcl Tcl-formatted output used internally by --tk |
| 3247 | ** --unified Unified diff. ~DIFF_SIDEBYSIDE |
| 3248 | ** -v|--verbose Show complete text of added or deleted files |
| 3249 | ** -w|--ignore-all-space Ignore all whitespaces DIFF_IGNORE_ALLWS |
| 3250 | ** --webpage Format output as a stand-alone HTML webpage |
| 3251 | ** -W|--width N N character lines. wColumn |
| 3252 | ** -y|--side-by-side Side-by-side diff. DIFF_SIDEBYSIDE |
| 3253 | ** -Z|--ignore-trailing-space Ignore eol-whitespaces DIFF_IGNORE_EOLWS |
| 3254 | */ |
| 3255 | void diff_options(DiffConfig *pCfg, int isGDiff, int bUnifiedTextOnly){ |
| 3256 |
+3
-3
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -1312,11 +1312,12 @@ | ||
| 1312 | 1312 | zFrom = mprintf("root:%s", zBranch); |
| 1313 | 1313 | } |
| 1314 | 1314 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 1315 | 1315 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 1316 | 1316 | } |
| 1317 | - g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0; | |
| 1317 | + diff_options(&DCfg, isGDiff, 0); | |
| 1318 | + determine_exec_relative_option(1); | |
| 1318 | 1319 | if( 0==zCheckin ){ |
| 1319 | 1320 | if( zTo==0 || againstUndo ){ |
| 1320 | 1321 | db_must_be_within_tree(); |
| 1321 | 1322 | }else if( zFrom==0 ){ |
| 1322 | 1323 | fossil_fatal("must use --from if --to is present"); |
| @@ -1324,13 +1325,12 @@ | ||
| 1324 | 1325 | db_find_and_open_repository(0, 0); |
| 1325 | 1326 | } |
| 1326 | 1327 | }else{ |
| 1327 | 1328 | db_find_and_open_repository(0, 0); |
| 1328 | 1329 | } |
| 1329 | - diff_options(&DCfg, isGDiff, 0); | |
| 1330 | - determine_exec_relative_option(1); | |
| 1331 | 1330 | verify_all_options(); |
| 1331 | + g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0; | |
| 1332 | 1332 | if( g.argc>=3 ){ |
| 1333 | 1333 | int i; |
| 1334 | 1334 | Blob fname; |
| 1335 | 1335 | pFileDir = fossil_malloc( sizeof(*pFileDir) * (g.argc-1) ); |
| 1336 | 1336 | memset(pFileDir, 0, sizeof(*pFileDir) * (g.argc-1)); |
| 1337 | 1337 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -1312,11 +1312,12 @@ | |
| 1312 | zFrom = mprintf("root:%s", zBranch); |
| 1313 | } |
| 1314 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 1315 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 1316 | } |
| 1317 | g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0; |
| 1318 | if( 0==zCheckin ){ |
| 1319 | if( zTo==0 || againstUndo ){ |
| 1320 | db_must_be_within_tree(); |
| 1321 | }else if( zFrom==0 ){ |
| 1322 | fossil_fatal("must use --from if --to is present"); |
| @@ -1324,13 +1325,12 @@ | |
| 1324 | db_find_and_open_repository(0, 0); |
| 1325 | } |
| 1326 | }else{ |
| 1327 | db_find_and_open_repository(0, 0); |
| 1328 | } |
| 1329 | diff_options(&DCfg, isGDiff, 0); |
| 1330 | determine_exec_relative_option(1); |
| 1331 | verify_all_options(); |
| 1332 | if( g.argc>=3 ){ |
| 1333 | int i; |
| 1334 | Blob fname; |
| 1335 | pFileDir = fossil_malloc( sizeof(*pFileDir) * (g.argc-1) ); |
| 1336 | memset(pFileDir, 0, sizeof(*pFileDir) * (g.argc-1)); |
| 1337 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -1312,11 +1312,12 @@ | |
| 1312 | zFrom = mprintf("root:%s", zBranch); |
| 1313 | } |
| 1314 | if( zCheckin!=0 && ( zFrom!=0 || zTo!=0 ) ){ |
| 1315 | fossil_fatal("cannot use --checkin together with --from or --to"); |
| 1316 | } |
| 1317 | diff_options(&DCfg, isGDiff, 0); |
| 1318 | determine_exec_relative_option(1); |
| 1319 | if( 0==zCheckin ){ |
| 1320 | if( zTo==0 || againstUndo ){ |
| 1321 | db_must_be_within_tree(); |
| 1322 | }else if( zFrom==0 ){ |
| 1323 | fossil_fatal("must use --from if --to is present"); |
| @@ -1324,13 +1325,12 @@ | |
| 1325 | db_find_and_open_repository(0, 0); |
| 1326 | } |
| 1327 | }else{ |
| 1328 | db_find_and_open_repository(0, 0); |
| 1329 | } |
| 1330 | verify_all_options(); |
| 1331 | g.diffCnt[0] = g.diffCnt[1] = g.diffCnt[2] = 0; |
| 1332 | if( g.argc>=3 ){ |
| 1333 | int i; |
| 1334 | Blob fname; |
| 1335 | pFileDir = fossil_malloc( sizeof(*pFileDir) * (g.argc-1) ); |
| 1336 | memset(pFileDir, 0, sizeof(*pFileDir) * (g.argc-1)); |
| 1337 |
+2
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -626,11 +626,13 @@ | ||
| 626 | 626 | return; |
| 627 | 627 | } |
| 628 | 628 | diffType = preferred_diff_type(); |
| 629 | 629 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 630 | 630 | vid = db_lget_int("checkout", 0); |
| 631 | + db_unprotect(PROTECT_ALL); | |
| 631 | 632 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 633 | + db_protect_pop(); | |
| 632 | 634 | style_set_current_feature("vinfo"); |
| 633 | 635 | zHostname = fossil_hostname(); |
| 634 | 636 | zCwd = file_getcwd(0,0); |
| 635 | 637 | if( zHostname ){ |
| 636 | 638 | style_header("Checkout at %s:%s", zHostname, zCwd); |
| 637 | 639 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -626,11 +626,13 @@ | |
| 626 | return; |
| 627 | } |
| 628 | diffType = preferred_diff_type(); |
| 629 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 630 | vid = db_lget_int("checkout", 0); |
| 631 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 632 | style_set_current_feature("vinfo"); |
| 633 | zHostname = fossil_hostname(); |
| 634 | zCwd = file_getcwd(0,0); |
| 635 | if( zHostname ){ |
| 636 | style_header("Checkout at %s:%s", zHostname, zCwd); |
| 637 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -626,11 +626,13 @@ | |
| 626 | return; |
| 627 | } |
| 628 | diffType = preferred_diff_type(); |
| 629 | pCfg = construct_diff_flags(diffType, &DCfg); |
| 630 | vid = db_lget_int("checkout", 0); |
| 631 | db_unprotect(PROTECT_ALL); |
| 632 | vfile_check_signature(vid, CKSIG_ENOTFILE); |
| 633 | db_protect_pop(); |
| 634 | style_set_current_feature("vinfo"); |
| 635 | zHostname = fossil_hostname(); |
| 636 | zCwd = file_getcwd(0,0); |
| 637 | if( zHostname ){ |
| 638 | style_header("Checkout at %s:%s", zHostname, zCwd); |
| 639 |