Fossil SCM

Do not allow the current repository to be added to the set of files for a repository. Ticket [8e9136e8].

drh 2008-07-23 17:36 trunk
Commit 141c31792b66447284b5cc668844fa8b1c85ee4a
1 file changed +5
+5
--- src/add.c
+++ src/add.c
@@ -38,17 +38,21 @@
3838
** at the next commit.
3939
*/
4040
void add_cmd(void){
4141
int i;
4242
int vid;
43
+ Blob repo;
4344
4445
db_must_be_within_tree();
4546
vid = db_lget_int("checkout",0);
4647
if( vid==0 ){
4748
fossil_panic("no checkout to add to");
4849
}
4950
db_begin_transaction();
51
+ if( !file_tree_name(g.zRepositoryName, &repo, 0) ){
52
+ blob_zero(&repo);
53
+ }
5054
for(i=2; i<g.argc; i++){
5155
char *zName;
5256
char *zPath;
5357
Blob pathname;
5458
int isDir;
@@ -65,10 +69,11 @@
6569
file_tree_name(zName, &pathname, 1);
6670
zPath = blob_str(&pathname);
6771
if( strcmp(zPath, "manifest")==0
6872
|| strcmp(zPath, "_FOSSIL_")==0
6973
|| strcmp(zPath, "manifest.uuid")==0
74
+ || blob_compare(&pathname, &repo)==0
7075
){
7176
fossil_warning("cannot add %s", zPath);
7277
}else{
7378
if( !file_is_simple_pathname(zPath) ){
7479
fossil_fatal("filename contains illegal characters: %s", zPath);
7580
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button