Since Fossil 1.30 the function db_record_repository_filename() in db.c performs update of config table with two commands:

1. DELETE record to circumvent caseInsensitivity problems:

    db_optional_sql("repository",
        "DELETE FROM config WHERE name %s = %Q;",
        filename_collation(), zCkoutSetting
    );

2. UPDATE record:
        
    db_optional_sql("repository",
        "REPLACE INTO config(name,value,mtime)"
        "VALUES(%Q,1,now());",
        zCkoutSetting
    );

        
Statements collected by db_optional_sql() are executed in db_end_transaction() but in REVERSE ORDER. So the DELETE statement will
be the last and withdraws the UPDATE.

I applied the following patch to my fossil.exe, swapping the statements:

Index: db.c
==================================================================
--- db.c
+++ db.c
@@ -2138,19 +2138,19 @@
       "REPLACE INTO global_config(name, value)"
       "VALUES(%Q,%Q);",
       zCkoutSetting, blob_str(&full)
     );
     db_swap_connections();
-    db_optional_sql("repository",
-        "DELETE FROM config WHERE name %s = %Q;",
-        filename_collation(), zCkoutSetting
-    );
     db_optional_sql("repository",
         "REPLACE INTO config(name,value,mtime)"
         "VALUES(%Q,1,now());",
         zCkoutSetting
     );
+    db_optional_sql("repository",
+        "DELETE FROM config WHERE name %s = %Q;",
+        filename_collation(), zCkoutSetting
+    );
     fossil_free(zCkoutSetting);
     blob_reset(&localRoot);
   }else{
     db_swap_connections();
   }
==================================================================

[Another option would be to execute the db.azBeforeCommit array in db_end_transaction() in reversed order but maybe there was a reason other than convenient programming style.]

Now that db_record_repository_filename() works for me I experience something else -- opening a new repository still doesn't report the 'ckout' to REPOSITORY.config.

Cause: By default there is *no initial commit* in Fossil 1.30.
'open_cmd' calls 'checkout_cmd' which starts a transaction. But since there are no leaves or events or blobs in a new repository `zVers` is 0 and the transaction isn't commited, discarding the optional sqls from 'db_record_repository_filename'.

Of course the first commit or `init --date-override` will do the trick.

BTW: What's the reason for storing the 'ckout' in the REPOFILE via 'db_optional_sql'? Why not via 'db_multi_exec'?

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

_______________________________________________
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