Fossil SCM
Restore the ability to use amend outside an open check-out disabled by [8c22e1bbcd8ec048]. Only allow interactive edits within an open check-out. Perhaps unixTempFileDir() could be used to locate a suitable TMP location for the edit in the event that there is not an open-checkout.
Commit
afef5fb5fc49fdd92fa497a3394153a2c3a36c029cd685062951af074d620290
Parent
55e2487585d96d6…
2 files changed
+2
+1
-1
+2
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -1202,10 +1202,12 @@ | ||
| 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 | + if ( g.zRepositoryOption ) | |
| 1208 | + fossil_fatal("interactive edits must be done within an open check-out"); | |
| 1207 | 1209 | assert( g.zLocalRoot!=0 ); |
| 1208 | 1210 | file_relative_name(g.zLocalRoot, &fname, 1); |
| 1209 | 1211 | zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'", |
| 1210 | 1212 | blob_str(&fname)); |
| 1211 | 1213 | blob_reset(&fname); |
| 1212 | 1214 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1202,10 +1202,12 @@ | |
| 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 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -1202,10 +1202,12 @@ | |
| 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 | if ( g.zRepositoryOption ) |
| 1208 | fossil_fatal("interactive edits must be done within an open check-out"); |
| 1209 | assert( g.zLocalRoot!=0 ); |
| 1210 | file_relative_name(g.zLocalRoot, &fname, 1); |
| 1211 | zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'", |
| 1212 | blob_str(&fname)); |
| 1213 | blob_reset(&fname); |
| 1214 |
+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_must_be_within_tree(); | |
| 2951 | + db_find_and_open_repository(0,0); | |
| 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_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 |
| --- 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 |