Another iteration.  We need to add an extra byte in case the true
value is the string "true".  I've re-expressed the loop as a 'for' loop
while I was at it.

Sorry for the spam.  Again, please treat the below with caution until 
I have (or someone else has) a chance to exercise it better.

Index: src/vfile.c
==================================================================
--- src/vfile.c
+++ src/vfile.c
@@ -268,21 +268,29 @@
   int promptFlag         /* Prompt user to confirm overwrites */
 ){
   Stmt q;
   Blob content;
   int nRepos = strlen(g.zLocalRoot);
+  char bSawSymlinkSetting = 0;
 
+  /* In order to properly write out symlinks rather than regular files,
+  ** we must first observe the .fossil-settings/allow-symlinks file if it
+  ** exists.  If it does, we want to make sure we see it prior to any
+  ** symlink files.  This is why we sort ascending by 'islink'.
+  */
   if( vid>0 && id==0 ){
     db_prepare(&q, "SELECT id, %Q || pathname, mrid, isexe, islink"
                    "  FROM vfile"
-                   " WHERE vid=%d AND mrid>0",
+                   " WHERE vid=%d AND mrid>0"
+                   " ORDER BY islink ASC",
                    g.zLocalRoot, vid);
   }else{
     assert( vid==0 && id>0 );
     db_prepare(&q, "SELECT id, %Q || pathname, mrid, isexe, islink"
                    "  FROM vfile"
-                   " WHERE id=%d AND mrid>0",
+                   " WHERE id=%d AND mrid>0"
+                   " ORDER BY islink ASC",
                    g.zLocalRoot, id);
   }
   while( db_step(&q)==SQLITE_ROW ){
     int id, rid, isExe, isLink;
     const char *zName;
@@ -291,10 +299,21 @@
     zName = db_column_text(&q, 1);
     rid = db_column_int(&q, 2);
     isExe = db_column_int(&q, 3);
     isLink = db_column_int(&q, 4);
     content_get(rid, &content);
+    if( !bSawSymlinkSetting &&
+        zName[nRepos]=='.' && zName[nRepos+1]=='f' && zName[nRepos+2]=='o' &&
+        strcmp(&zName[nRepos], ".fossil-settings/allow-symlinks")==0
+    ){
+      char zValue[5] = {0,0,0,0,0};
+      int i;
+      bSawSymlinkSetting = 1;
+      const char* zCont = blob_str(&content);
+      for(i=0; i<4 && zCont[i]!=0 && zCont[i]!='\n';++i ){ zValue[i]=zCont[i]; 
}
+      g.allowSymlinks = is_truth(zValue);
+    }
     if( file_is_the_same(&content, zName) ){
       blob_reset(&content);
       if( file_wd_setexe(zName, isExe) ){
         db_multi_exec("UPDATE vfile SET mtime=%lld WHERE id=%d",
                       file_wd_mtime(zName), id);


--
Eric A. Rubin-Smith

Aterlo Networks, Inc.
http://aterlo.com

_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to