Fossil SCM
Report an error if the "artifact" command does not find an artifact.
Commit
4e47bdc4a316c3d00e9ca07773a4a2e6cfed5547
Parent
ced22eb209f462a…
1 file changed
+5
-2
+5
-2
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -322,12 +322,15 @@ | ||
| 322 | 322 | const char *zFile; |
| 323 | 323 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 324 | 324 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); |
| 325 | 325 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 326 | 326 | rid = name_to_rid(g.argv[2]); |
| 327 | - content_get(rid, &content); | |
| 328 | - blob_write_to_file(&content, zFile); | |
| 327 | + if( content_get(rid, &content) ){ | |
| 328 | + blob_write_to_file(&content, zFile); | |
| 329 | + }else{ | |
| 330 | + fossil_fatal("no such artifact: %s", g.argv[2]); | |
| 331 | + } | |
| 329 | 332 | } |
| 330 | 333 | |
| 331 | 334 | /* |
| 332 | 335 | ** COMMAND: test-content-rawget |
| 333 | 336 | ** |
| 334 | 337 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -322,12 +322,15 @@ | |
| 322 | const char *zFile; |
| 323 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 324 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); |
| 325 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 326 | rid = name_to_rid(g.argv[2]); |
| 327 | content_get(rid, &content); |
| 328 | blob_write_to_file(&content, zFile); |
| 329 | } |
| 330 | |
| 331 | /* |
| 332 | ** COMMAND: test-content-rawget |
| 333 | ** |
| 334 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -322,12 +322,15 @@ | |
| 322 | const char *zFile; |
| 323 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 324 | if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?"); |
| 325 | zFile = g.argc==4 ? g.argv[3] : "-"; |
| 326 | rid = name_to_rid(g.argv[2]); |
| 327 | if( content_get(rid, &content) ){ |
| 328 | blob_write_to_file(&content, zFile); |
| 329 | }else{ |
| 330 | fossil_fatal("no such artifact: %s", g.argv[2]); |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | /* |
| 335 | ** COMMAND: test-content-rawget |
| 336 | ** |
| 337 |