Author: kotkov
Date: Wed Jan 18 12:55:44 2023
New Revision: 1906768
URL: http://svn.apache.org/viewvc?rev=1906768&view=rev
Log:
When upgrading a working copy to format 32, ensure that we always have the
corresponding rows in the SETTINGS table.
Before this change, we treated an absent row as having the "old" settings
when making a query. Let's instead change the upgrade routine so that the
row is always present — so that both newly created and upgraded working
copies would have the same entries in the SETTINGS table.
* subversion/libsvn_wc/wc-metadata.sql
(STMT_UPGRADE_TO_32): Populate the SETTINGS table.
* subversion/libsvn_wc/wc_db_wcroot.c
(read_settings): Expect the query to return a single row.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c
Modified: subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-metadata.sql?rev=1906768&r1=1906767&r2=1906768&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-metadata.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-metadata.sql Wed Jan 18 12:55:44
2023
@@ -784,6 +784,9 @@ CREATE TABLE SETTINGS (
store_pristine INTEGER
);
+/* Migrate existing working copy settings. */
+INSERT OR IGNORE INTO SETTINGS SELECT id, 1 FROM WCROOT;
+
PRAGMA user_version = 32;
/* ------------------------------------------------------------------------- */
Modified: subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c?rev=1906768&r1=1906767&r2=1906768&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c Wed Jan 18 12:55:44
2023
@@ -507,18 +507,14 @@ read_settings(svn_boolean_t *store_prist
if (format >= SVN_WC__HAS_SETTINGS)
{
svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_SETTINGS));
SVN_ERR(svn_sqlite__bindf(stmt, "i", wc_id));
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
+ SVN_ERR(svn_sqlite__step_row(stmt));
- if (have_row)
- *store_pristine_p = svn_sqlite__column_boolean(stmt, 0);
- else
- *store_pristine_p = TRUE;
+ *store_pristine_p = svn_sqlite__column_boolean(stmt, 0);
- SVN_ERR(svn_sqlite__reset(stmt));
+ SVN_ERR(svn_sqlite__step_done(stmt));
}
else
{