You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2021/08/27 13:47:52 UTC

svn commit: r1892640 - /subversion/trunk/subversion/libsvn_wc/wc_db_pristine.c

Author: kotkov
Date: Fri Aug 27 13:47:52 2021
New Revision: 1892640

URL: http://svn.apache.org/viewvc?rev=1892640&view=rev
Log:
When installing the pristine text, preconfigure the read-only attribute on
the install stream, instead of setting it on the file after install.

This way the installation completes in a single step.  It also enables the
I/O optimization provided by the install stream where the attributes are
set by handle without re-opening the file.

* subversion/libsvn_wc/wc_db_pristine.c
  (pristine_install_txn): Use svn_stream__install_set_read_only() to
   preconfigure the read-only attribute.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db_pristine.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_pristine.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_pristine.c?rev=1892640&r1=1892639&r2=1892640&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_pristine.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_pristine.c Fri Aug 27 13:47:52 2021
@@ -335,6 +335,8 @@ pristine_install_txn(svn_sqlite__db_t *s
   {
     apr_off_t size;
 
+    svn_stream__install_set_read_only(install_stream, TRUE);
+
     SVN_ERR(svn_stream__install_finalize(NULL, &size, install_stream,
                                          scratch_pool));
     SVN_ERR(svn_stream__install_stream(install_stream, pristine_abspath,
@@ -345,8 +347,6 @@ pristine_install_txn(svn_sqlite__db_t *s
     SVN_ERR(svn_sqlite__bind_checksum(stmt, 2, md5_checksum, scratch_pool));
     SVN_ERR(svn_sqlite__bind_int64(stmt, 3, size));
     SVN_ERR(svn_sqlite__insert(NULL, stmt));
-
-    SVN_ERR(svn_io_set_file_read_only(pristine_abspath, FALSE, scratch_pool));
   }
 
   return SVN_NO_ERROR;