Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Unnecessary blob_zero() calls: the following prompt_user() call already does a blob_zero() call internally. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
14768c24e5080377fdc7a7a0b8bc0ebd |
| User & Date: | jan.nijtmans 2014-02-20 09:42:15.722 |
Context
|
2014-02-20
| ||
| 10:01 | Fix [a56db55924]: Crash on STASH DIFF command ... (check-in: 1c39f113d1 user: jan.nijtmans tags: trunk) | |
| 09:42 | Unnecessary blob_zero() calls: the following prompt_user() call already does a blob_zero() call internally. ... (check-in: 14768c24e5 user: jan.nijtmans tags: trunk) | |
| 08:51 | When doing "fossil add foo.*" but the user forgets there is a foo.o besides the foo.c and foo.h, and "ignore-glob" contains the "*.o" pattern, fossil will properly warn for this situation and ask what to do. (for Fossil itself this is no issue, as the *.o files are kept in a separate directory, but not all projects do that). Example: /Localdata/workspace/tcl8.6/unix $ touch foo.c foo.h foo.o /Localdata/workspace/tcl8.6/unix $ fossil add foo.* file "foo.o" matches "ignore-glob". Add it (a=all/y/N)? n ADDED foo.c ADDED foo.h ... (check-in: 6ec21b58a2 user: jan.nijtmans tags: trunk) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
297 298 299 300 301 302 303 |
}else{
char *zTreeName = &zName[nRoot];
if( !forceFlag && glob_match(pIgnore, zTreeName) ){
Blob ans;
char cReply;
char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
"Add it (a=all/y/N)? ", zTreeName);
| < | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
}else{
char *zTreeName = &zName[nRoot];
if( !forceFlag && glob_match(pIgnore, zTreeName) ){
Blob ans;
char cReply;
char *prompt = mprintf("file \"%s\" matches \"ignore-glob\". "
"Add it (a=all/y/N)? ", zTreeName);
prompt_user(prompt, &ans);
cReply = blob_str(&ans)[0];
blob_reset(&ans);
if( cReply=='a' || cReply=='A' ){
forceFlag = 1;
}else if( cReply!='y' && cReply!='Y' ){
blob_reset(&fullName);
|
| ︙ | ︙ |
Changes to src/branch.c.
| ︙ | ︙ | |||
138 139 140 141 142 143 144 |
blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
md5sum_blob(&branch, &mcksum);
blob_appendf(&branch, "Z %b\n", &mcksum);
if( !noSign && clearsign(&branch, &branch) ){
Blob ans;
char cReply;
| < | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
blob_appendf(&branch, "U %F\n", zUserOvrd ? zUserOvrd : g.zLogin);
md5sum_blob(&branch, &mcksum);
blob_appendf(&branch, "Z %b\n", &mcksum);
if( !noSign && clearsign(&branch, &branch) ){
Blob ans;
char cReply;
prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y'){
db_end_transaction(1);
fossil_exit(1);
}
}
|
| ︙ | ︙ |
Changes to src/checkin.c.
| ︙ | ︙ | |||
598 599 600 601 602 603 604 |
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
Blob ans;
char cReply;
char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
zName+nRoot);
| < | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
if( !allFileFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
Blob ans;
char cReply;
char *prompt = mprintf("Remove unmanaged file \"%s\" (a=all/y/N)? ",
zName+nRoot);
prompt_user(prompt, &ans);
cReply = blob_str(&ans)[0];
if( cReply=='a' || cReply=='A' ){
allFileFlag = 1;
}else if( cReply!='y' && cReply!='Y' ){
blob_reset(&ans);
continue;
|
| ︙ | ︙ | |||
640 641 642 643 644 645 646 |
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
Blob ans;
char cReply;
char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
zName+nRoot);
| < | 639 640 641 642 643 644 645 646 647 648 649 650 651 652 |
while( db_step(&q)==SQLITE_ROW ){
const char *zName = db_column_text(&q, 0);
if( !allDirFlag && !dryRunFlag && !glob_match(pClean, zName+nRoot) ){
Blob ans;
char cReply;
char *prompt = mprintf("Remove empty directory \"%s\" (a=all/y/N)? ",
zName+nRoot);
prompt_user(prompt, &ans);
cReply = blob_str(&ans)[0];
if( cReply=='a' || cReply=='A' ){
allDirFlag = 1;
}else if( cReply!='y' && cReply!='Y' ){
blob_reset(&ans);
continue;
|
| ︙ | ︙ | |||
1286 1287 1288 1289 1290 1291 1292 |
if( encodingOk ){
return 0; /* We don't want encoding warnings for this file. */
}
zWarning = "Unicode";
zDisable = "\"encoding-glob\" setting";
}
file_relative_name(zFilename, &fname, 0);
| < | 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 |
if( encodingOk ){
return 0; /* We don't want encoding warnings for this file. */
}
zWarning = "Unicode";
zDisable = "\"encoding-glob\" setting";
}
file_relative_name(zFilename, &fname, 0);
zMsg = mprintf(
"%s contains %s. Use --no-warnings or the %s to disable this warning.\n"
"Commit anyhow (a=all/%sy/N)? ",
blob_str(&fname), zWarning, zDisable, zConvert);
prompt_user(zMsg, &ans);
fossil_free(zMsg);
cReply = blob_str(&ans)[0];
|
| ︙ | ︙ | |||
1529 1530 1531 1532 1533 1534 1535 |
}
/*
** Autosync if autosync is enabled and this is not a private check-in.
*/
if( !g.markPrivate ){
if( autosync(SYNC_PULL) ){
| < < < | 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 |
}
/*
** Autosync if autosync is enabled and this is not a private check-in.
*/
if( !g.markPrivate ){
if( autosync(SYNC_PULL) ){
prompt_user("continue in spite of sync failure (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
}
/* Require confirmation to continue with the check-in if there is
** clock skew
*/
if( g.clockSkewSeen ){
prompt_user("continue in spite of time skew (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
/* There are two ways this command may be executed. If there are
** no arguments following the word "commit", then all modified files
** in the checked out directory are committed. If one or more arguments
** follows "commit", then only those files are committed.
**
** After the following function call has returned, the Global.aCommitFile[]
** array is allocated to contain the "id" field from the vfile table
** for each file to be committed. Or, if aCommitFile is NULL, all files
** should be committed.
*/
if( select_commit_files() ){
prompt_user("continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
}
isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0 OR id<-2");
if( g.aCommitFile && isAMerge ){
fossil_fatal("cannot do a partial commit of a merge");
|
| ︙ | ︙ | |||
1662 1663 1664 1665 1666 1667 1668 |
blob_to_utf8_no_bom(&comment, 1);
}else if(dryRunFlag){
blob_zero(&comment);
}else{
char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
| < < | 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 |
blob_to_utf8_no_bom(&comment, 1);
}else if(dryRunFlag){
blob_zero(&comment);
}else{
char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
prepare_commit_comment(&comment, zInit, &sCiInfo, vid);
if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
}
free(zInit);
}
if( blob_size(&comment)==0 ){
if( !dryRunFlag ){
prompt_user("empty check-in comment. continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
}else{
|
| ︙ | ︙ | |||
1804 1805 1806 1807 1808 1809 1810 |
blob_reset(&delta);
}
}else if( forceDelta ){
fossil_fatal("unable to find a baseline-manifest for the delta");
}
}
if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
| < | 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 |
blob_reset(&delta);
}
}else if( forceDelta ){
fossil_fatal("unable to find a baseline-manifest for the delta");
}
}
if( !noSign && !g.markPrivate && clearsign(&manifest, &manifest) ){
prompt_user("unable to sign manifest. continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
}
|
| ︙ | ︙ |
Changes to src/rebuild.c.
| ︙ | ︙ | |||
791 792 793 794 795 796 797 |
int bNeedRebuild = 0;
db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
db_close(1);
db_open_repository(g.zRepositoryName);
if( !bForce ){
Blob ans;
char cReply;
| < | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 |
int bNeedRebuild = 0;
db_find_and_open_repository(OPEN_ANY_SCHEMA, 2);
db_close(1);
db_open_repository(g.zRepositoryName);
if( !bForce ){
Blob ans;
char cReply;
prompt_user(
"Scrubbing the repository will permanently delete information.\n"
"Changes cannot be undone. Continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply!='y' && cReply!='Y' ){
fossil_exit(1);
}
|
| ︙ | ︙ |
Changes to src/stash.c.
| ︙ | ︙ | |||
566 567 568 569 570 571 572 |
if( n==0 ) fossil_print("empty stash\n");
}else
if( memcmp(zCmd, "drop", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0 ){
int allFlag = find_option("all", "a", 0)!=0;
if( allFlag ){
Blob ans;
char cReply;
| < | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
if( n==0 ) fossil_print("empty stash\n");
}else
if( memcmp(zCmd, "drop", nCmd)==0 || memcmp(zCmd, "rm", nCmd)==0 ){
int allFlag = find_option("all", "a", 0)!=0;
if( allFlag ){
Blob ans;
char cReply;
prompt_user("This action is not undoable. Continue (y/N)? ", &ans);
cReply = blob_str(&ans)[0];
if( cReply=='y' || cReply=='Y' ){
db_multi_exec("DELETE FROM stash; DELETE FROM stashfile;");
}
}else if( g.argc>=4 ){
int i;
|
| ︙ | ︙ |