Diff
Not logged in

Differences From:

File src/checkin.c part of check-in [c5f4ec0ed5] - Undo inadvertant hacking changes in previous ci (should have been documentation only) by bharder on 2009-02-21 18:59:46. Also file src/checkin.c part of check-in [8be6204607] - 'fossil' encode tagnames for manifest (for ticket 15f49be6b2b1e) (allows for tags with spaces in name) by bharder on 2009-02-09 04:41:08. [view]

To:

File src/checkin.c part of check-in [5b29f6f65f] - typo fix by bharder on 2009-02-21 18:52:26. [view]

@@ -334,10 +334,20 @@
     g.aCommitFile = malloc(sizeof(int)*(g.argc-1));
 
     for(ii=2; ii<g.argc; ii++){
       int iId;
+      int isDir; /* -bch */
+      char *zName; /* -bch */
       file_tree_name(g.argv[ii], &b, 1);
-      iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b));
+      /* -bch start*/
+      zName=mprintf("%/",g.argv[ii]);
+      isDir=file_isdir(zName);
+      if (1==isDir) {
+	commit_directory_content(zPath);
+      }else {
+	/* -bch end */
+	iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b));
+      } /* -bch */
       if( iId<0 ){
         fossil_fatal("fossil knows nothing about: %s", g.argv[ii]);
       }
       g.aCommitFile[ii-2] = iId;
@@ -345,8 +355,46 @@
     }
     g.aCommitFile[ii-2] = 0;
   }
 }
+
+/*
+** commit directory
+*/
+
+void commit_directory_content(const char *zDir){
+  DIR *d;
+  int origSize;
+  struct dirent *pEntry;
+  Blob path;
+
+  blob_zero(&path);
+  blob_append(&path, zDir, -1);
+  origSize = blob_size(&path);
+  d = opendir(zDir);
+  if( d ){
+    while( (pEntry=readdir(d))!=0 ){
+      char *zPath;
+      if( pEntry->d_name[0]=='.' ) continue;
+      blob_appendf(&path, "/%s", pEntry->d_name);
+      zPath = blob_str(&path);
+      if( file_isdir(zPath)==1 ){
+        commit_directory_content(zPath);
+      }else if( file_isfile(zPath) ){
+	file_tree_name(g.argv[ii], &b, 1); /* -bch */
+	iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", zPath); /* -bch */
+	if( iId<0 ){
+	  fossil_fatal("fossil knows nothing about: %s", g.argv[ii]);
+	}
+	//        db_multi_exec("INSERT INTO sfile VALUES(%Q)", zPath);
+      }
+      blob_resize(&path, origSize);
+    }
+  }
+  closedir(d);
+  blob_reset(&path);
+}
+
 
 /*
 ** Return true if the check-in with RID=rid is a leaf.
 ** A leaf has no children in the same branch.