Fossil SCM
Do not allow the current repository to be added to the set of files for a repository. Ticket [8e9136e8].
Commit
141c31792b66447284b5cc668844fa8b1c85ee4a
Parent
2ecc407d9be8f07…
1 file changed
+5
+5
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -38,17 +38,21 @@ | ||
| 38 | 38 | ** at the next commit. |
| 39 | 39 | */ |
| 40 | 40 | void add_cmd(void){ |
| 41 | 41 | int i; |
| 42 | 42 | int vid; |
| 43 | + Blob repo; | |
| 43 | 44 | |
| 44 | 45 | db_must_be_within_tree(); |
| 45 | 46 | vid = db_lget_int("checkout",0); |
| 46 | 47 | if( vid==0 ){ |
| 47 | 48 | fossil_panic("no checkout to add to"); |
| 48 | 49 | } |
| 49 | 50 | db_begin_transaction(); |
| 51 | + if( !file_tree_name(g.zRepositoryName, &repo, 0) ){ | |
| 52 | + blob_zero(&repo); | |
| 53 | + } | |
| 50 | 54 | for(i=2; i<g.argc; i++){ |
| 51 | 55 | char *zName; |
| 52 | 56 | char *zPath; |
| 53 | 57 | Blob pathname; |
| 54 | 58 | int isDir; |
| @@ -65,10 +69,11 @@ | ||
| 65 | 69 | file_tree_name(zName, &pathname, 1); |
| 66 | 70 | zPath = blob_str(&pathname); |
| 67 | 71 | if( strcmp(zPath, "manifest")==0 |
| 68 | 72 | || strcmp(zPath, "_FOSSIL_")==0 |
| 69 | 73 | || strcmp(zPath, "manifest.uuid")==0 |
| 74 | + || blob_compare(&pathname, &repo)==0 | |
| 70 | 75 | ){ |
| 71 | 76 | fossil_warning("cannot add %s", zPath); |
| 72 | 77 | }else{ |
| 73 | 78 | if( !file_is_simple_pathname(zPath) ){ |
| 74 | 79 | fossil_fatal("filename contains illegal characters: %s", zPath); |
| 75 | 80 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -38,17 +38,21 @@ | |
| 38 | ** at the next commit. |
| 39 | */ |
| 40 | void add_cmd(void){ |
| 41 | int i; |
| 42 | int vid; |
| 43 | |
| 44 | db_must_be_within_tree(); |
| 45 | vid = db_lget_int("checkout",0); |
| 46 | if( vid==0 ){ |
| 47 | fossil_panic("no checkout to add to"); |
| 48 | } |
| 49 | db_begin_transaction(); |
| 50 | for(i=2; i<g.argc; i++){ |
| 51 | char *zName; |
| 52 | char *zPath; |
| 53 | Blob pathname; |
| 54 | int isDir; |
| @@ -65,10 +69,11 @@ | |
| 65 | file_tree_name(zName, &pathname, 1); |
| 66 | zPath = blob_str(&pathname); |
| 67 | if( strcmp(zPath, "manifest")==0 |
| 68 | || strcmp(zPath, "_FOSSIL_")==0 |
| 69 | || strcmp(zPath, "manifest.uuid")==0 |
| 70 | ){ |
| 71 | fossil_warning("cannot add %s", zPath); |
| 72 | }else{ |
| 73 | if( !file_is_simple_pathname(zPath) ){ |
| 74 | fossil_fatal("filename contains illegal characters: %s", zPath); |
| 75 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -38,17 +38,21 @@ | |
| 38 | ** at the next commit. |
| 39 | */ |
| 40 | void add_cmd(void){ |
| 41 | int i; |
| 42 | int vid; |
| 43 | Blob repo; |
| 44 | |
| 45 | db_must_be_within_tree(); |
| 46 | vid = db_lget_int("checkout",0); |
| 47 | if( vid==0 ){ |
| 48 | fossil_panic("no checkout to add to"); |
| 49 | } |
| 50 | db_begin_transaction(); |
| 51 | if( !file_tree_name(g.zRepositoryName, &repo, 0) ){ |
| 52 | blob_zero(&repo); |
| 53 | } |
| 54 | for(i=2; i<g.argc; i++){ |
| 55 | char *zName; |
| 56 | char *zPath; |
| 57 | Blob pathname; |
| 58 | int isDir; |
| @@ -65,10 +69,11 @@ | |
| 69 | file_tree_name(zName, &pathname, 1); |
| 70 | zPath = blob_str(&pathname); |
| 71 | if( strcmp(zPath, "manifest")==0 |
| 72 | || strcmp(zPath, "_FOSSIL_")==0 |
| 73 | || strcmp(zPath, "manifest.uuid")==0 |
| 74 | || blob_compare(&pathname, &repo)==0 |
| 75 | ){ |
| 76 | fossil_warning("cannot add %s", zPath); |
| 77 | }else{ |
| 78 | if( !file_is_simple_pathname(zPath) ){ |
| 79 | fossil_fatal("filename contains illegal characters: %s", zPath); |
| 80 |