Fossil SCM
The "amend" command only works from within an open check-out.
Commit
8c22e1bbcd8ec048b8062e87cd8a54a9d930f6bb16f7ec745ccbce5ac3d24f5f
Parent
9e5f06deae5af21…
3 files changed
+2
-1
+4
+1
-1
+2
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1202,12 +1202,13 @@ | ||
| 1202 | 1202 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 1203 | 1203 | zFile = mprintf("-"); |
| 1204 | 1204 | }else{ |
| 1205 | 1205 | Blob fname; |
| 1206 | 1206 | blob_zero(&fname); |
| 1207 | + assert( g.zLocalRoot!=0 ); | |
| 1207 | 1208 | file_relative_name(g.zLocalRoot, &fname, 1); |
| 1208 | - zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", | |
| 1209 | + zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'", | |
| 1209 | 1210 | blob_str(&fname)); |
| 1210 | 1211 | blob_reset(&fname); |
| 1211 | 1212 | } |
| 1212 | 1213 | #if defined(_WIN32) |
| 1213 | 1214 | blob_add_cr(pPrompt); |
| 1214 | 1215 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1202,12 +1202,13 @@ | |
| 1202 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 1203 | zFile = mprintf("-"); |
| 1204 | }else{ |
| 1205 | Blob fname; |
| 1206 | blob_zero(&fname); |
| 1207 | file_relative_name(g.zLocalRoot, &fname, 1); |
| 1208 | zFile = db_text(0, "SELECT '%qci-comment-' || hex(randomblob(6)) || '.txt'", |
| 1209 | blob_str(&fname)); |
| 1210 | blob_reset(&fname); |
| 1211 | } |
| 1212 | #if defined(_WIN32) |
| 1213 | blob_add_cr(pPrompt); |
| 1214 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1202,12 +1202,13 @@ | |
| 1202 | "# Type \".\" on a line by itself when you are done:\n", -1); |
| 1203 | zFile = mprintf("-"); |
| 1204 | }else{ |
| 1205 | Blob fname; |
| 1206 | blob_zero(&fname); |
| 1207 | assert( g.zLocalRoot!=0 ); |
| 1208 | file_relative_name(g.zLocalRoot, &fname, 1); |
| 1209 | zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'", |
| 1210 | blob_str(&fname)); |
| 1211 | blob_reset(&fname); |
| 1212 | } |
| 1213 | #if defined(_WIN32) |
| 1214 | blob_add_cr(pPrompt); |
| 1215 |
M
src/db.c
+4
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -1615,10 +1615,14 @@ | ||
| 1615 | 1615 | |
| 1616 | 1616 | /* |
| 1617 | 1617 | ** Open the local database. If unable, exit with an error. |
| 1618 | 1618 | */ |
| 1619 | 1619 | void db_must_be_within_tree(void){ |
| 1620 | + if( find_repository_option() ){ | |
| 1621 | + fossil_fatal("the \"%s\" command only work from within an open check-out", | |
| 1622 | + g.argv[1]); | |
| 1623 | + } | |
| 1620 | 1624 | if( db_open_local(0)==0 ){ |
| 1621 | 1625 | fossil_fatal("current directory is not within an open checkout"); |
| 1622 | 1626 | } |
| 1623 | 1627 | db_open_repository(0); |
| 1624 | 1628 | db_verify_schema(); |
| 1625 | 1629 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1615,10 +1615,14 @@ | |
| 1615 | |
| 1616 | /* |
| 1617 | ** Open the local database. If unable, exit with an error. |
| 1618 | */ |
| 1619 | void db_must_be_within_tree(void){ |
| 1620 | if( db_open_local(0)==0 ){ |
| 1621 | fossil_fatal("current directory is not within an open checkout"); |
| 1622 | } |
| 1623 | db_open_repository(0); |
| 1624 | db_verify_schema(); |
| 1625 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -1615,10 +1615,14 @@ | |
| 1615 | |
| 1616 | /* |
| 1617 | ** Open the local database. If unable, exit with an error. |
| 1618 | */ |
| 1619 | void db_must_be_within_tree(void){ |
| 1620 | if( find_repository_option() ){ |
| 1621 | fossil_fatal("the \"%s\" command only work from within an open check-out", |
| 1622 | g.argv[1]); |
| 1623 | } |
| 1624 | if( db_open_local(0)==0 ){ |
| 1625 | fossil_fatal("current directory is not within an open checkout"); |
| 1626 | } |
| 1627 | db_open_repository(0); |
| 1628 | db_verify_schema(); |
| 1629 |
+1
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -2946,11 +2946,11 @@ | ||
| 2946 | 2946 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 2947 | 2947 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 2948 | 2948 | fClose = find_option("close",0,0)!=0; |
| 2949 | 2949 | fHide = find_option("hide",0,0)!=0; |
| 2950 | 2950 | zChngTime = find_option("chngtime",0,1); |
| 2951 | - db_find_and_open_repository(0,0); | |
| 2951 | + db_must_be_within_tree(); | |
| 2952 | 2952 | user_select(); |
| 2953 | 2953 | verify_all_options(); |
| 2954 | 2954 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 2955 | 2955 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| 2956 | 2956 | if( rid==0 && !is_a_version(rid) ) fossil_fatal("no such check-in"); |
| 2957 | 2957 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2946,11 +2946,11 @@ | |
| 2946 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 2947 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 2948 | fClose = find_option("close",0,0)!=0; |
| 2949 | fHide = find_option("hide",0,0)!=0; |
| 2950 | zChngTime = find_option("chngtime",0,1); |
| 2951 | db_find_and_open_repository(0,0); |
| 2952 | user_select(); |
| 2953 | verify_all_options(); |
| 2954 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 2955 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| 2956 | if( rid==0 && !is_a_version(rid) ) fossil_fatal("no such check-in"); |
| 2957 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -2946,11 +2946,11 @@ | |
| 2946 | pzNewTags = find_repeatable_option("tag",0,&nTags); |
| 2947 | pzCancelTags = find_repeatable_option("cancel",0,&nCancels); |
| 2948 | fClose = find_option("close",0,0)!=0; |
| 2949 | fHide = find_option("hide",0,0)!=0; |
| 2950 | zChngTime = find_option("chngtime",0,1); |
| 2951 | db_must_be_within_tree(); |
| 2952 | user_select(); |
| 2953 | verify_all_options(); |
| 2954 | if( g.argc<3 || g.argc>=4 ) usage(AMEND_USAGE_STMT); |
| 2955 | rid = name_to_typed_rid(g.argv[2], "ci"); |
| 2956 | if( rid==0 && !is_a_version(rid) ) fossil_fatal("no such check-in"); |
| 2957 |