Fossil SCM
In the 'all' command, use strcmp instead of strncmp to compare the subcommand name to avoid the problem described in [forum:8ec0c228c1ce8da5|forum post 8ec0c228c1ce8da5], where (e.g.) the subcommand 's' evaluates to 'server' and 'p' to 'push' despite both of those being ambiguous subcommand name prefixes.
Commit
e098d810dcaded1e40a81ddd93126b538faf2c0dc9e8dce1b2e5550c1d3f9cd0
Parent
85b83206f42cb64…
1 file changed
+26
-28
+26
-28
| --- src/allrepo.c | ||
| +++ src/allrepo.c | ||
| @@ -153,11 +153,10 @@ | ||
| 153 | 153 | ** --dry-run If given, display instead of run actions. |
| 154 | 154 | ** --showfile Show the repository or checkout being operated upon. |
| 155 | 155 | ** --stop-on-error Halt immediately if any subprocess fails. |
| 156 | 156 | */ |
| 157 | 157 | void all_cmd(void){ |
| 158 | - int n; | |
| 159 | 158 | Stmt q; |
| 160 | 159 | const char *zCmd; |
| 161 | 160 | char *zSyscmd; |
| 162 | 161 | Blob extra; |
| 163 | 162 | int useCheckouts = 0; |
| @@ -176,35 +175,35 @@ | ||
| 176 | 175 | } |
| 177 | 176 | |
| 178 | 177 | if( g.argc<3 ){ |
| 179 | 178 | usage("SUBCOMMAND ..."); |
| 180 | 179 | } |
| 181 | - n = strlen(g.argv[2]); | |
| 182 | 180 | db_open_config(1, 0); |
| 183 | 181 | blob_zero(&extra); |
| 184 | 182 | zCmd = g.argv[2]; |
| 185 | 183 | if( !login_is_nobody() ) blob_appendf(&extra, " -U %s", g.zLogin); |
| 186 | - if( strncmp(zCmd, "ui", n)==0 || strncmp(zCmd, "server", n)==0 ){ | |
| 184 | + if( fossil_strcmp(zCmd, "ui")==0 | |
| 185 | + || fossil_strcmp(zCmd, "server")==0 ){ | |
| 187 | 186 | g.argv[1] = g.argv[2]; |
| 188 | 187 | g.argv[2] = "/"; |
| 189 | 188 | cmd_webserver(); |
| 190 | 189 | return; |
| 191 | 190 | } |
| 192 | - if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ | |
| 191 | + if( fossil_strcmp(zCmd, "list")==0 || fossil_strcmp(zCmd,"ls")==0 ){ | |
| 193 | 192 | zCmd = "list"; |
| 194 | 193 | useCheckouts = find_option("ckout","c",0)!=0; |
| 195 | - }else if( strncmp(zCmd, "backup", n)==0 ){ | |
| 194 | + }else if( fossil_strcmp(zCmd, "backup")==0 ){ | |
| 196 | 195 | char *zDest; |
| 197 | 196 | zCmd = "backup -R"; |
| 198 | 197 | collect_argument(&extra, "overwrite",0); |
| 199 | 198 | if( g.argc!=4 ) usage("backup DIRECTORY"); |
| 200 | 199 | zDest = g.argv[3]; |
| 201 | 200 | if( file_isdir(zDest, ExtFILE)!=1 ){ |
| 202 | 201 | fossil_fatal("argument to \"fossil all backup\" must be a directory"); |
| 203 | 202 | } |
| 204 | 203 | blob_appendf(&extra, " %$", zDest); |
| 205 | - }else if( strncmp(zCmd, "clean", n)==0 ){ | |
| 204 | + }else if( fossil_strcmp(zCmd, "clean")==0 ){ | |
| 206 | 205 | zCmd = "clean --chdir"; |
| 207 | 206 | collect_argument(&extra, "allckouts",0); |
| 208 | 207 | collect_argument_value(&extra, "case-sensitive"); |
| 209 | 208 | collect_argument_value(&extra, "clean"); |
| 210 | 209 | collect_argument(&extra, "dirsonly",0); |
| @@ -217,27 +216,27 @@ | ||
| 217 | 216 | collect_argument(&extra, "no-prompt",0); |
| 218 | 217 | collect_argument(&extra, "temp",0); |
| 219 | 218 | collect_argument(&extra, "verbose","v"); |
| 220 | 219 | collect_argument(&extra, "whatif",0); |
| 221 | 220 | useCheckouts = 1; |
| 222 | - }else if( strncmp(zCmd, "config", n)==0 ){ | |
| 221 | + }else if( fossil_strcmp(zCmd, "config")==0 ){ | |
| 223 | 222 | zCmd = "config -R"; |
| 224 | 223 | collect_argv(&extra, 3); |
| 225 | 224 | (void)find_option("legacy",0,0); |
| 226 | 225 | (void)find_option("overwrite",0,0); |
| 227 | 226 | verify_all_options(); |
| 228 | 227 | if( g.argc!=5 || fossil_strcmp(g.argv[3],"pull")!=0 ){ |
| 229 | 228 | usage("configure pull AREA ?OPTIONS?"); |
| 230 | 229 | } |
| 231 | - }else if( strncmp(zCmd, "dbstat", n)==0 ){ | |
| 230 | + }else if( fossil_strcmp(zCmd, "dbstat")==0 ){ | |
| 232 | 231 | zCmd = "dbstat --omit-version-info -R"; |
| 233 | 232 | showLabel = 1; |
| 234 | 233 | quiet = 1; |
| 235 | 234 | collect_argument(&extra, "brief", "b"); |
| 236 | 235 | collect_argument(&extra, "db-check", 0); |
| 237 | 236 | collect_argument(&extra, "db-verify", 0); |
| 238 | - }else if( strncmp(zCmd, "extras", n)==0 ){ | |
| 237 | + }else if( fossil_strcmp(zCmd, "extras")==0 ){ | |
| 239 | 238 | if( showFile ){ |
| 240 | 239 | zCmd = "extras --chdir"; |
| 241 | 240 | }else{ |
| 242 | 241 | zCmd = "extras --header --chdir"; |
| 243 | 242 | } |
| @@ -247,32 +246,31 @@ | ||
| 247 | 246 | collect_argument_value(&extra, "ignore"); |
| 248 | 247 | collect_argument(&extra, "rel-paths",0); |
| 249 | 248 | useCheckouts = 1; |
| 250 | 249 | stopOnError = 0; |
| 251 | 250 | quiet = 1; |
| 252 | - }else if( strncmp(zCmd, "git", n)==0 ){ | |
| 251 | + }else if( fossil_strcmp(zCmd, "git")==0 ){ | |
| 253 | 252 | if( g.argc<4 ){ |
| 254 | 253 | usage("git (export|status)"); |
| 255 | 254 | }else{ |
| 256 | - int n3 = (int)strlen(g.argv[3]); | |
| 257 | - if( strncmp(g.argv[3], "export", n3)==0 ){ | |
| 255 | + if( fossil_strcmp(g.argv[3], "export")==0 ){ | |
| 258 | 256 | zCmd = "git export --if-mirrored -R"; |
| 259 | - }else if( strncmp(g.argv[3], "status", n3)==0 ){ | |
| 257 | + }else if( fossil_strcmp(g.argv[3], "status")==0 ){ | |
| 260 | 258 | zCmd = "git status --by-all -q -R"; |
| 261 | 259 | quiet = 1; |
| 262 | 260 | }else{ |
| 263 | 261 | usage("git (export|status)"); |
| 264 | 262 | } |
| 265 | 263 | } |
| 266 | - }else if( strncmp(zCmd, "push", n)==0 ){ | |
| 264 | + }else if( fossil_strcmp(zCmd, "push")==0 ){ | |
| 267 | 265 | zCmd = "push -autourl -R"; |
| 268 | 266 | collect_argument(&extra, "verbose","v"); |
| 269 | - }else if( strncmp(zCmd, "pull", n)==0 ){ | |
| 267 | + }else if( fossil_strcmp(zCmd, "pull")==0 ){ | |
| 270 | 268 | zCmd = "pull -autourl -R"; |
| 271 | 269 | collect_argument(&extra, "verbose","v"); |
| 272 | 270 | collect_argument(&extra, "share-links",0); |
| 273 | - }else if( strncmp(zCmd, "rebuild", n)==0 ){ | |
| 271 | + }else if( fossil_strcmp(zCmd, "rebuild")==0 ){ | |
| 274 | 272 | zCmd = "rebuild"; |
| 275 | 273 | collect_argument(&extra, "cluster",0); |
| 276 | 274 | collect_argument(&extra, "compress",0); |
| 277 | 275 | collect_argument(&extra, "compress-only",0); |
| 278 | 276 | collect_argument(&extra, "noverify",0); |
| @@ -283,40 +281,40 @@ | ||
| 283 | 281 | collect_argument(&extra, "wal",0); |
| 284 | 282 | collect_argument(&extra, "stats",0); |
| 285 | 283 | collect_argument(&extra, "index",0); |
| 286 | 284 | collect_argument(&extra, "noindex",0); |
| 287 | 285 | collect_argument(&extra, "ifneeded", 0); |
| 288 | - }else if( strncmp(zCmd, "setting", n)==0 ){ | |
| 286 | + }else if( fossil_strcmp(zCmd, "setting")==0 ){ | |
| 289 | 287 | zCmd = "setting -R"; |
| 290 | 288 | collect_argv(&extra, 3); |
| 291 | - }else if( strncmp(zCmd, "unset", n)==0 ){ | |
| 289 | + }else if( fossil_strcmp(zCmd, "unset")==0 ){ | |
| 292 | 290 | zCmd = "unset -R"; |
| 293 | 291 | collect_argv(&extra, 3); |
| 294 | - }else if( strncmp(zCmd, "fts-config", n)==0 ){ | |
| 292 | + }else if( fossil_strcmp(zCmd, "fts-config")==0 ){ | |
| 295 | 293 | zCmd = "fts-config -R"; |
| 296 | 294 | collect_argv(&extra, 3); |
| 297 | - }else if( strncmp(zCmd, "sync", n)==0 ){ | |
| 295 | + }else if( fossil_strcmp(zCmd, "sync")==0 ){ | |
| 298 | 296 | zCmd = "sync -autourl -R"; |
| 299 | 297 | collect_argument(&extra, "share-links",0); |
| 300 | 298 | collect_argument(&extra, "verbose","v"); |
| 301 | 299 | collect_argument(&extra, "unversioned","u"); |
| 302 | - }else if( strncmp(zCmd, "test-integrity", n)==0 ){ | |
| 300 | + }else if( fossil_strcmp(zCmd, "test-integrity")==0 ){ | |
| 303 | 301 | collect_argument(&extra, "db-only", "d"); |
| 304 | 302 | collect_argument(&extra, "parse", 0); |
| 305 | 303 | collect_argument(&extra, "quick", "q"); |
| 306 | 304 | zCmd = "test-integrity"; |
| 307 | - }else if( strncmp(zCmd, "test-orphans", n)==0 ){ | |
| 305 | + }else if( fossil_strcmp(zCmd, "test-orphans")==0 ){ | |
| 308 | 306 | zCmd = "test-orphans -R"; |
| 309 | - }else if( strncmp(zCmd, "test-missing", n)==0 ){ | |
| 307 | + }else if( fossil_strcmp(zCmd, "test-missing")==0 ){ | |
| 310 | 308 | zCmd = "test-missing -q -R"; |
| 311 | 309 | collect_argument(&extra, "notshunned",0); |
| 312 | - }else if( strncmp(zCmd, "changes", n)==0 ){ | |
| 310 | + }else if( fossil_strcmp(zCmd, "changes")==0 ){ | |
| 313 | 311 | zCmd = "changes --quiet --header --chdir"; |
| 314 | 312 | useCheckouts = 1; |
| 315 | 313 | stopOnError = 0; |
| 316 | 314 | quiet = 1; |
| 317 | - }else if( strncmp(zCmd, "ignore", n)==0 ){ | |
| 315 | + }else if( fossil_strcmp(zCmd, "ignore")==0 ){ | |
| 318 | 316 | int j; |
| 319 | 317 | Blob fn = BLOB_INITIALIZER; |
| 320 | 318 | Blob sql = BLOB_INITIALIZER; |
| 321 | 319 | useCheckouts = find_option("ckout","c",0)!=0; |
| 322 | 320 | verify_all_options(); |
| @@ -338,11 +336,11 @@ | ||
| 338 | 336 | db_end_transaction(0); |
| 339 | 337 | blob_reset(&sql); |
| 340 | 338 | blob_reset(&fn); |
| 341 | 339 | blob_reset(&extra); |
| 342 | 340 | return; |
| 343 | - }else if( strncmp(zCmd, "add", n)==0 ){ | |
| 341 | + }else if( fossil_strcmp(zCmd, "add")==0 ){ | |
| 344 | 342 | int j; |
| 345 | 343 | Blob fn = BLOB_INITIALIZER; |
| 346 | 344 | Blob sql = BLOB_INITIALIZER; |
| 347 | 345 | verify_all_options(); |
| 348 | 346 | db_begin_transaction(); |
| @@ -375,15 +373,15 @@ | ||
| 375 | 373 | db_end_transaction(0); |
| 376 | 374 | blob_reset(&sql); |
| 377 | 375 | blob_reset(&fn); |
| 378 | 376 | blob_reset(&extra); |
| 379 | 377 | return; |
| 380 | - }else if( strncmp(zCmd, "info", n)==0 ){ | |
| 378 | + }else if( fossil_strcmp(zCmd, "info")==0 ){ | |
| 381 | 379 | zCmd = "info"; |
| 382 | 380 | showLabel = 1; |
| 383 | 381 | quiet = 1; |
| 384 | - }else if( strncmp(zCmd, "cache", n)==0 ){ | |
| 382 | + }else if( fossil_strcmp(zCmd, "cache")==0 ){ | |
| 385 | 383 | zCmd = "cache -R"; |
| 386 | 384 | showLabel = 1; |
| 387 | 385 | collect_argv(&extra, 3); |
| 388 | 386 | }else{ |
| 389 | 387 | fossil_fatal("\"all\" subcommand should be one of: " |
| 390 | 388 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -153,11 +153,10 @@ | |
| 153 | ** --dry-run If given, display instead of run actions. |
| 154 | ** --showfile Show the repository or checkout being operated upon. |
| 155 | ** --stop-on-error Halt immediately if any subprocess fails. |
| 156 | */ |
| 157 | void all_cmd(void){ |
| 158 | int n; |
| 159 | Stmt q; |
| 160 | const char *zCmd; |
| 161 | char *zSyscmd; |
| 162 | Blob extra; |
| 163 | int useCheckouts = 0; |
| @@ -176,35 +175,35 @@ | |
| 176 | } |
| 177 | |
| 178 | if( g.argc<3 ){ |
| 179 | usage("SUBCOMMAND ..."); |
| 180 | } |
| 181 | n = strlen(g.argv[2]); |
| 182 | db_open_config(1, 0); |
| 183 | blob_zero(&extra); |
| 184 | zCmd = g.argv[2]; |
| 185 | if( !login_is_nobody() ) blob_appendf(&extra, " -U %s", g.zLogin); |
| 186 | if( strncmp(zCmd, "ui", n)==0 || strncmp(zCmd, "server", n)==0 ){ |
| 187 | g.argv[1] = g.argv[2]; |
| 188 | g.argv[2] = "/"; |
| 189 | cmd_webserver(); |
| 190 | return; |
| 191 | } |
| 192 | if( strncmp(zCmd, "list", n)==0 || strncmp(zCmd,"ls",n)==0 ){ |
| 193 | zCmd = "list"; |
| 194 | useCheckouts = find_option("ckout","c",0)!=0; |
| 195 | }else if( strncmp(zCmd, "backup", n)==0 ){ |
| 196 | char *zDest; |
| 197 | zCmd = "backup -R"; |
| 198 | collect_argument(&extra, "overwrite",0); |
| 199 | if( g.argc!=4 ) usage("backup DIRECTORY"); |
| 200 | zDest = g.argv[3]; |
| 201 | if( file_isdir(zDest, ExtFILE)!=1 ){ |
| 202 | fossil_fatal("argument to \"fossil all backup\" must be a directory"); |
| 203 | } |
| 204 | blob_appendf(&extra, " %$", zDest); |
| 205 | }else if( strncmp(zCmd, "clean", n)==0 ){ |
| 206 | zCmd = "clean --chdir"; |
| 207 | collect_argument(&extra, "allckouts",0); |
| 208 | collect_argument_value(&extra, "case-sensitive"); |
| 209 | collect_argument_value(&extra, "clean"); |
| 210 | collect_argument(&extra, "dirsonly",0); |
| @@ -217,27 +216,27 @@ | |
| 217 | collect_argument(&extra, "no-prompt",0); |
| 218 | collect_argument(&extra, "temp",0); |
| 219 | collect_argument(&extra, "verbose","v"); |
| 220 | collect_argument(&extra, "whatif",0); |
| 221 | useCheckouts = 1; |
| 222 | }else if( strncmp(zCmd, "config", n)==0 ){ |
| 223 | zCmd = "config -R"; |
| 224 | collect_argv(&extra, 3); |
| 225 | (void)find_option("legacy",0,0); |
| 226 | (void)find_option("overwrite",0,0); |
| 227 | verify_all_options(); |
| 228 | if( g.argc!=5 || fossil_strcmp(g.argv[3],"pull")!=0 ){ |
| 229 | usage("configure pull AREA ?OPTIONS?"); |
| 230 | } |
| 231 | }else if( strncmp(zCmd, "dbstat", n)==0 ){ |
| 232 | zCmd = "dbstat --omit-version-info -R"; |
| 233 | showLabel = 1; |
| 234 | quiet = 1; |
| 235 | collect_argument(&extra, "brief", "b"); |
| 236 | collect_argument(&extra, "db-check", 0); |
| 237 | collect_argument(&extra, "db-verify", 0); |
| 238 | }else if( strncmp(zCmd, "extras", n)==0 ){ |
| 239 | if( showFile ){ |
| 240 | zCmd = "extras --chdir"; |
| 241 | }else{ |
| 242 | zCmd = "extras --header --chdir"; |
| 243 | } |
| @@ -247,32 +246,31 @@ | |
| 247 | collect_argument_value(&extra, "ignore"); |
| 248 | collect_argument(&extra, "rel-paths",0); |
| 249 | useCheckouts = 1; |
| 250 | stopOnError = 0; |
| 251 | quiet = 1; |
| 252 | }else if( strncmp(zCmd, "git", n)==0 ){ |
| 253 | if( g.argc<4 ){ |
| 254 | usage("git (export|status)"); |
| 255 | }else{ |
| 256 | int n3 = (int)strlen(g.argv[3]); |
| 257 | if( strncmp(g.argv[3], "export", n3)==0 ){ |
| 258 | zCmd = "git export --if-mirrored -R"; |
| 259 | }else if( strncmp(g.argv[3], "status", n3)==0 ){ |
| 260 | zCmd = "git status --by-all -q -R"; |
| 261 | quiet = 1; |
| 262 | }else{ |
| 263 | usage("git (export|status)"); |
| 264 | } |
| 265 | } |
| 266 | }else if( strncmp(zCmd, "push", n)==0 ){ |
| 267 | zCmd = "push -autourl -R"; |
| 268 | collect_argument(&extra, "verbose","v"); |
| 269 | }else if( strncmp(zCmd, "pull", n)==0 ){ |
| 270 | zCmd = "pull -autourl -R"; |
| 271 | collect_argument(&extra, "verbose","v"); |
| 272 | collect_argument(&extra, "share-links",0); |
| 273 | }else if( strncmp(zCmd, "rebuild", n)==0 ){ |
| 274 | zCmd = "rebuild"; |
| 275 | collect_argument(&extra, "cluster",0); |
| 276 | collect_argument(&extra, "compress",0); |
| 277 | collect_argument(&extra, "compress-only",0); |
| 278 | collect_argument(&extra, "noverify",0); |
| @@ -283,40 +281,40 @@ | |
| 283 | collect_argument(&extra, "wal",0); |
| 284 | collect_argument(&extra, "stats",0); |
| 285 | collect_argument(&extra, "index",0); |
| 286 | collect_argument(&extra, "noindex",0); |
| 287 | collect_argument(&extra, "ifneeded", 0); |
| 288 | }else if( strncmp(zCmd, "setting", n)==0 ){ |
| 289 | zCmd = "setting -R"; |
| 290 | collect_argv(&extra, 3); |
| 291 | }else if( strncmp(zCmd, "unset", n)==0 ){ |
| 292 | zCmd = "unset -R"; |
| 293 | collect_argv(&extra, 3); |
| 294 | }else if( strncmp(zCmd, "fts-config", n)==0 ){ |
| 295 | zCmd = "fts-config -R"; |
| 296 | collect_argv(&extra, 3); |
| 297 | }else if( strncmp(zCmd, "sync", n)==0 ){ |
| 298 | zCmd = "sync -autourl -R"; |
| 299 | collect_argument(&extra, "share-links",0); |
| 300 | collect_argument(&extra, "verbose","v"); |
| 301 | collect_argument(&extra, "unversioned","u"); |
| 302 | }else if( strncmp(zCmd, "test-integrity", n)==0 ){ |
| 303 | collect_argument(&extra, "db-only", "d"); |
| 304 | collect_argument(&extra, "parse", 0); |
| 305 | collect_argument(&extra, "quick", "q"); |
| 306 | zCmd = "test-integrity"; |
| 307 | }else if( strncmp(zCmd, "test-orphans", n)==0 ){ |
| 308 | zCmd = "test-orphans -R"; |
| 309 | }else if( strncmp(zCmd, "test-missing", n)==0 ){ |
| 310 | zCmd = "test-missing -q -R"; |
| 311 | collect_argument(&extra, "notshunned",0); |
| 312 | }else if( strncmp(zCmd, "changes", n)==0 ){ |
| 313 | zCmd = "changes --quiet --header --chdir"; |
| 314 | useCheckouts = 1; |
| 315 | stopOnError = 0; |
| 316 | quiet = 1; |
| 317 | }else if( strncmp(zCmd, "ignore", n)==0 ){ |
| 318 | int j; |
| 319 | Blob fn = BLOB_INITIALIZER; |
| 320 | Blob sql = BLOB_INITIALIZER; |
| 321 | useCheckouts = find_option("ckout","c",0)!=0; |
| 322 | verify_all_options(); |
| @@ -338,11 +336,11 @@ | |
| 338 | db_end_transaction(0); |
| 339 | blob_reset(&sql); |
| 340 | blob_reset(&fn); |
| 341 | blob_reset(&extra); |
| 342 | return; |
| 343 | }else if( strncmp(zCmd, "add", n)==0 ){ |
| 344 | int j; |
| 345 | Blob fn = BLOB_INITIALIZER; |
| 346 | Blob sql = BLOB_INITIALIZER; |
| 347 | verify_all_options(); |
| 348 | db_begin_transaction(); |
| @@ -375,15 +373,15 @@ | |
| 375 | db_end_transaction(0); |
| 376 | blob_reset(&sql); |
| 377 | blob_reset(&fn); |
| 378 | blob_reset(&extra); |
| 379 | return; |
| 380 | }else if( strncmp(zCmd, "info", n)==0 ){ |
| 381 | zCmd = "info"; |
| 382 | showLabel = 1; |
| 383 | quiet = 1; |
| 384 | }else if( strncmp(zCmd, "cache", n)==0 ){ |
| 385 | zCmd = "cache -R"; |
| 386 | showLabel = 1; |
| 387 | collect_argv(&extra, 3); |
| 388 | }else{ |
| 389 | fossil_fatal("\"all\" subcommand should be one of: " |
| 390 |
| --- src/allrepo.c | |
| +++ src/allrepo.c | |
| @@ -153,11 +153,10 @@ | |
| 153 | ** --dry-run If given, display instead of run actions. |
| 154 | ** --showfile Show the repository or checkout being operated upon. |
| 155 | ** --stop-on-error Halt immediately if any subprocess fails. |
| 156 | */ |
| 157 | void all_cmd(void){ |
| 158 | Stmt q; |
| 159 | const char *zCmd; |
| 160 | char *zSyscmd; |
| 161 | Blob extra; |
| 162 | int useCheckouts = 0; |
| @@ -176,35 +175,35 @@ | |
| 175 | } |
| 176 | |
| 177 | if( g.argc<3 ){ |
| 178 | usage("SUBCOMMAND ..."); |
| 179 | } |
| 180 | db_open_config(1, 0); |
| 181 | blob_zero(&extra); |
| 182 | zCmd = g.argv[2]; |
| 183 | if( !login_is_nobody() ) blob_appendf(&extra, " -U %s", g.zLogin); |
| 184 | if( fossil_strcmp(zCmd, "ui")==0 |
| 185 | || fossil_strcmp(zCmd, "server")==0 ){ |
| 186 | g.argv[1] = g.argv[2]; |
| 187 | g.argv[2] = "/"; |
| 188 | cmd_webserver(); |
| 189 | return; |
| 190 | } |
| 191 | if( fossil_strcmp(zCmd, "list")==0 || fossil_strcmp(zCmd,"ls")==0 ){ |
| 192 | zCmd = "list"; |
| 193 | useCheckouts = find_option("ckout","c",0)!=0; |
| 194 | }else if( fossil_strcmp(zCmd, "backup")==0 ){ |
| 195 | char *zDest; |
| 196 | zCmd = "backup -R"; |
| 197 | collect_argument(&extra, "overwrite",0); |
| 198 | if( g.argc!=4 ) usage("backup DIRECTORY"); |
| 199 | zDest = g.argv[3]; |
| 200 | if( file_isdir(zDest, ExtFILE)!=1 ){ |
| 201 | fossil_fatal("argument to \"fossil all backup\" must be a directory"); |
| 202 | } |
| 203 | blob_appendf(&extra, " %$", zDest); |
| 204 | }else if( fossil_strcmp(zCmd, "clean")==0 ){ |
| 205 | zCmd = "clean --chdir"; |
| 206 | collect_argument(&extra, "allckouts",0); |
| 207 | collect_argument_value(&extra, "case-sensitive"); |
| 208 | collect_argument_value(&extra, "clean"); |
| 209 | collect_argument(&extra, "dirsonly",0); |
| @@ -217,27 +216,27 @@ | |
| 216 | collect_argument(&extra, "no-prompt",0); |
| 217 | collect_argument(&extra, "temp",0); |
| 218 | collect_argument(&extra, "verbose","v"); |
| 219 | collect_argument(&extra, "whatif",0); |
| 220 | useCheckouts = 1; |
| 221 | }else if( fossil_strcmp(zCmd, "config")==0 ){ |
| 222 | zCmd = "config -R"; |
| 223 | collect_argv(&extra, 3); |
| 224 | (void)find_option("legacy",0,0); |
| 225 | (void)find_option("overwrite",0,0); |
| 226 | verify_all_options(); |
| 227 | if( g.argc!=5 || fossil_strcmp(g.argv[3],"pull")!=0 ){ |
| 228 | usage("configure pull AREA ?OPTIONS?"); |
| 229 | } |
| 230 | }else if( fossil_strcmp(zCmd, "dbstat")==0 ){ |
| 231 | zCmd = "dbstat --omit-version-info -R"; |
| 232 | showLabel = 1; |
| 233 | quiet = 1; |
| 234 | collect_argument(&extra, "brief", "b"); |
| 235 | collect_argument(&extra, "db-check", 0); |
| 236 | collect_argument(&extra, "db-verify", 0); |
| 237 | }else if( fossil_strcmp(zCmd, "extras")==0 ){ |
| 238 | if( showFile ){ |
| 239 | zCmd = "extras --chdir"; |
| 240 | }else{ |
| 241 | zCmd = "extras --header --chdir"; |
| 242 | } |
| @@ -247,32 +246,31 @@ | |
| 246 | collect_argument_value(&extra, "ignore"); |
| 247 | collect_argument(&extra, "rel-paths",0); |
| 248 | useCheckouts = 1; |
| 249 | stopOnError = 0; |
| 250 | quiet = 1; |
| 251 | }else if( fossil_strcmp(zCmd, "git")==0 ){ |
| 252 | if( g.argc<4 ){ |
| 253 | usage("git (export|status)"); |
| 254 | }else{ |
| 255 | if( fossil_strcmp(g.argv[3], "export")==0 ){ |
| 256 | zCmd = "git export --if-mirrored -R"; |
| 257 | }else if( fossil_strcmp(g.argv[3], "status")==0 ){ |
| 258 | zCmd = "git status --by-all -q -R"; |
| 259 | quiet = 1; |
| 260 | }else{ |
| 261 | usage("git (export|status)"); |
| 262 | } |
| 263 | } |
| 264 | }else if( fossil_strcmp(zCmd, "push")==0 ){ |
| 265 | zCmd = "push -autourl -R"; |
| 266 | collect_argument(&extra, "verbose","v"); |
| 267 | }else if( fossil_strcmp(zCmd, "pull")==0 ){ |
| 268 | zCmd = "pull -autourl -R"; |
| 269 | collect_argument(&extra, "verbose","v"); |
| 270 | collect_argument(&extra, "share-links",0); |
| 271 | }else if( fossil_strcmp(zCmd, "rebuild")==0 ){ |
| 272 | zCmd = "rebuild"; |
| 273 | collect_argument(&extra, "cluster",0); |
| 274 | collect_argument(&extra, "compress",0); |
| 275 | collect_argument(&extra, "compress-only",0); |
| 276 | collect_argument(&extra, "noverify",0); |
| @@ -283,40 +281,40 @@ | |
| 281 | collect_argument(&extra, "wal",0); |
| 282 | collect_argument(&extra, "stats",0); |
| 283 | collect_argument(&extra, "index",0); |
| 284 | collect_argument(&extra, "noindex",0); |
| 285 | collect_argument(&extra, "ifneeded", 0); |
| 286 | }else if( fossil_strcmp(zCmd, "setting")==0 ){ |
| 287 | zCmd = "setting -R"; |
| 288 | collect_argv(&extra, 3); |
| 289 | }else if( fossil_strcmp(zCmd, "unset")==0 ){ |
| 290 | zCmd = "unset -R"; |
| 291 | collect_argv(&extra, 3); |
| 292 | }else if( fossil_strcmp(zCmd, "fts-config")==0 ){ |
| 293 | zCmd = "fts-config -R"; |
| 294 | collect_argv(&extra, 3); |
| 295 | }else if( fossil_strcmp(zCmd, "sync")==0 ){ |
| 296 | zCmd = "sync -autourl -R"; |
| 297 | collect_argument(&extra, "share-links",0); |
| 298 | collect_argument(&extra, "verbose","v"); |
| 299 | collect_argument(&extra, "unversioned","u"); |
| 300 | }else if( fossil_strcmp(zCmd, "test-integrity")==0 ){ |
| 301 | collect_argument(&extra, "db-only", "d"); |
| 302 | collect_argument(&extra, "parse", 0); |
| 303 | collect_argument(&extra, "quick", "q"); |
| 304 | zCmd = "test-integrity"; |
| 305 | }else if( fossil_strcmp(zCmd, "test-orphans")==0 ){ |
| 306 | zCmd = "test-orphans -R"; |
| 307 | }else if( fossil_strcmp(zCmd, "test-missing")==0 ){ |
| 308 | zCmd = "test-missing -q -R"; |
| 309 | collect_argument(&extra, "notshunned",0); |
| 310 | }else if( fossil_strcmp(zCmd, "changes")==0 ){ |
| 311 | zCmd = "changes --quiet --header --chdir"; |
| 312 | useCheckouts = 1; |
| 313 | stopOnError = 0; |
| 314 | quiet = 1; |
| 315 | }else if( fossil_strcmp(zCmd, "ignore")==0 ){ |
| 316 | int j; |
| 317 | Blob fn = BLOB_INITIALIZER; |
| 318 | Blob sql = BLOB_INITIALIZER; |
| 319 | useCheckouts = find_option("ckout","c",0)!=0; |
| 320 | verify_all_options(); |
| @@ -338,11 +336,11 @@ | |
| 336 | db_end_transaction(0); |
| 337 | blob_reset(&sql); |
| 338 | blob_reset(&fn); |
| 339 | blob_reset(&extra); |
| 340 | return; |
| 341 | }else if( fossil_strcmp(zCmd, "add")==0 ){ |
| 342 | int j; |
| 343 | Blob fn = BLOB_INITIALIZER; |
| 344 | Blob sql = BLOB_INITIALIZER; |
| 345 | verify_all_options(); |
| 346 | db_begin_transaction(); |
| @@ -375,15 +373,15 @@ | |
| 373 | db_end_transaction(0); |
| 374 | blob_reset(&sql); |
| 375 | blob_reset(&fn); |
| 376 | blob_reset(&extra); |
| 377 | return; |
| 378 | }else if( fossil_strcmp(zCmd, "info")==0 ){ |
| 379 | zCmd = "info"; |
| 380 | showLabel = 1; |
| 381 | quiet = 1; |
| 382 | }else if( fossil_strcmp(zCmd, "cache")==0 ){ |
| 383 | zCmd = "cache -R"; |
| 384 | showLabel = 1; |
| 385 | collect_argv(&extra, 3); |
| 386 | }else{ |
| 387 | fossil_fatal("\"all\" subcommand should be one of: " |
| 388 |