You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2014/12/11 12:28:59 UTC

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

Author: philip
Date: Thu Dec 11 11:28:59 2014
New Revision: 1644599

URL: http://svn.apache.org/r1644599
Log:
Followup to r1644595, need a total order to make the sort stable.

* subversion/libsvn_client/patch.c
  (sort_matched_hunks): Sort unmatched items.

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=1644599&r1=1644598&r2=1644599&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Thu Dec 11 11:28:59 2014
@@ -2141,8 +2141,9 @@ send_patch_notification(const patch_targ
 }
 
 /* Implements the callback for svn_sort__array.  Puts hunks that match
-   before hunks that do not match, and puts hunks that match in order
-   based on postion matched. */
+   before hunks that do not match, puts hunks that match in order
+   based on postion matched, puts hunks that do not match in order
+   based on original position. */
 static int
 sort_matched_hunks(const void *a, const void *b)
 {
@@ -2160,6 +2161,13 @@ sort_matched_hunks(const void *a, const
   else if (matched2)
     /* Only second matches, put it before first. */
     return 1;
+  else
+    {
+      /* Neither matches, sort by original_start. */
+      if (svn_diff_hunk_get_original_start(item1->hunk)
+          > svn_diff_hunk_get_original_start(item2->hunk))
+        return 1;
+    }
 
   return -1;
 }