subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1706588 - /subversion/branches/1.9.x-patch-fixes/subversion/libsvn_client/patch.c
Date Sat, 03 Oct 2015 14:10:47 GMT
Author: rhuijben
Date: Sat Oct  3 14:10:47 2015
New Revision: 1706588

URL: http://svn.apache.org/viewvc?rev=1706588&view=rev
Log:
On the patch fixes branch: Simplify symlink handling like r1706446 for compatibility with
platforms that don't support symlinks.

Modified:
    subversion/branches/1.9.x-patch-fixes/subversion/libsvn_client/patch.c

Modified: subversion/branches/1.9.x-patch-fixes/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x-patch-fixes/subversion/libsvn_client/patch.c?rev=1706588&r1=1706587&r2=1706588&view=diff
==============================================================================
--- subversion/branches/1.9.x-patch-fixes/subversion/libsvn_client/patch.c (original)
+++ subversion/branches/1.9.x-patch-fixes/subversion/libsvn_client/patch.c Sat Oct  3 14:10:47
2015
@@ -933,30 +933,6 @@ seek_symlink(void *baton, apr_off_t offs
   return SVN_NO_ERROR;
 }
 
-
-/* Set the target of the symlink accessed via BATON.
- * The contents of BUF must be a valid "normal form" of a symlink. */
-static svn_error_t *
-write_symlink(void *baton, const char *buf, apr_size_t len,
-              apr_pool_t *scratch_pool)
-{
-  const char *target_abspath = baton;
-
-  /* We assume the entire symlink is written at once, as the patch
-     format is line based */
-
-  {
-    svn_stream_t *stream;
-    SVN_ERR(svn_subst_create_specialfile(&stream, target_abspath,
-                                         scratch_pool, scratch_pool));
-    SVN_ERR(svn_stream_write(stream, buf, &len));
-    SVN_ERR(svn_stream_close(stream));
-  }
-
-  return SVN_NO_ERROR;
-}
-
-
 /* Return a suitable filename for the target of PATCH.
  * Examine the ``old'' and ``new'' file names, and choose the file name
  * with the fewest path components, the shortest basename, and the shortest
@@ -1178,34 +1154,17 @@ init_patch_target(patch_target_t **patch
             }
         }
 
-      if (! target->is_symlink)
-        {
-          /* Open a temporary file to write the patched result to. */
-          SVN_ERR(svn_io_open_unique_file3(&target->patched_file,
-                                           &target->patched_path, NULL,
-                                           remove_tempfiles ?
-                                             svn_io_file_del_on_pool_cleanup :
-                                             svn_io_file_del_none,
-                                           result_pool, scratch_pool));
-
-          /* Put the write callback in place. */
-          content->write = write_file;
-          content->write_baton = target->patched_file;
-        }
-      else
-        {
-          /* Put the write callback in place. */
-          SVN_ERR(svn_io_open_unique_file3(NULL,
-                                           &target->patched_path, NULL,
-                                           remove_tempfiles ?
-                                             svn_io_file_del_on_pool_cleanup :
-                                             svn_io_file_del_none,
-                                           result_pool, scratch_pool));
-
-          content->write_baton = (void*)target->patched_path;
-
-          content->write = write_symlink;
-        }
+      /* Open a temporary file to write the patched result to. */
+      SVN_ERR(svn_io_open_unique_file3(&target->patched_file,
+                                        &target->patched_path, NULL,
+                                        remove_tempfiles ?
+                                          svn_io_file_del_on_pool_cleanup :
+                                          svn_io_file_del_none,
+                                        result_pool, scratch_pool));
+
+      /* Put the write callback in place. */
+      content->write = write_file;
+      content->write_baton = target->patched_file;
 
       /* Open a temporary file to write rejected hunks to. */
       SVN_ERR(svn_io_open_unique_file3(&target->reject_file,
@@ -2539,10 +2498,10 @@ apply_one_patch(patch_target_t **patch_t
        * will be closed later in write_out_rejected_hunks(). */
       if (target->kind_on_disk == svn_node_file)
         SVN_ERR(svn_io_file_close(target->file, scratch_pool));
-
-      SVN_ERR(svn_io_file_close(target->patched_file, scratch_pool));
     }
 
+  SVN_ERR(svn_io_file_close(target->patched_file, scratch_pool));
+
   if (! target->skipped)
     {
       apr_finfo_t working_file;



Mime
View raw message