You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/09/13 17:31:49 UTC

svn commit: r996574 - /subversion/trunk/subversion/libsvn_client/patch.c

Author: stsp
Date: Mon Sep 13 15:31:49 2010
New Revision: 996574

URL: http://svn.apache.org/viewvc?rev=996574&view=rev
Log:
* subversion/libsvn_client/patch.c
  (match_hunk): When matching modified text, use the length of the modified
   text instead of the length of the original text. This bug only affected
   fuzzy matches, and since we don't do fuzzy matches on the modified text,
   it never triggered. Fixing it anyway.

Modified:
    subversion/trunk/subversion/libsvn_client/patch.c

Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=996574&r1=996573&r2=996574&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Mon Sep 13 15:31:49 2010
@@ -811,7 +811,7 @@ match_hunk(svn_boolean_t *matched, targe
   svn_boolean_t hunk_eof;
   svn_boolean_t lines_matched;
   apr_pool_t *iterpool;
-  svn_linenum_t original_length;
+  svn_linenum_t hunk_length;
   svn_linenum_t leading_context;
   svn_linenum_t trailing_context;
 
@@ -823,13 +823,18 @@ match_hunk(svn_boolean_t *matched, targe
   saved_line = content_info->current_line;
   lines_read = 0;
   lines_matched = FALSE;
-  original_length = svn_diff_hunk_get_original_length(hunk);
   leading_context = svn_diff_hunk_get_leading_context(hunk);
   trailing_context = svn_diff_hunk_get_trailing_context(hunk);
   if (match_modified)
-    SVN_ERR(svn_diff_hunk_reset_modified_text(hunk));
+    {
+      SVN_ERR(svn_diff_hunk_reset_modified_text(hunk));
+      hunk_length = svn_diff_hunk_get_modified_length(hunk);
+    }
   else
-    SVN_ERR(svn_diff_hunk_reset_original_text(hunk));
+    {
+      SVN_ERR(svn_diff_hunk_reset_original_text(hunk));
+      hunk_length = svn_diff_hunk_get_original_length(hunk);
+    }
   iterpool = svn_pool_create(pool);
   do
     {
@@ -858,7 +863,7 @@ match_hunk(svn_boolean_t *matched, targe
         {
           if (lines_read <= fuzz && leading_context > fuzz)
             lines_matched = TRUE;
-          else if (lines_read > original_length - fuzz &&
+          else if (lines_read > hunk_length - fuzz &&
                    trailing_context > fuzz)
             lines_matched = TRUE;
           else