[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: `svn diff' paths abbreviated wrongly

From: Karl Fogel <kfogel_at_red-bean.com>
Date: Fri, 03 Oct 2008 01:22:07 -0400

Karl Fogel <kfogel_at_red-bean.com> writes:
> Debugging now.

Got a fix. I'll commit when it passes "make *check", but it's this:

[[[
Fix bug whereby 2-URL diff inserted a path separator into a path component.

* subversion/libsvn_client/diff.c
  (diff_content_changed): Just call svn_path_get_longest_ancestor,
    instead of trying (and failing) to duplicate it inline.

Found by: neels
(But this follows up to r9693, and is really part of issue #1771.)

See original report:

   http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=143771
   From: Neels J Hofmeyr <neels_at_elego.de>
   To: Subversion Developers <dev_at_subversion.tigris.org>
   Subject: Re: `svn diff' paths abbreviated wrongly
   Date: Fri, 03 Oct 2008 05:05:03 +0200
   Message-ID: <48E58BDF.5090406_at_elego.de>
]]]

Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 33405)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -422,7 +422,7 @@
   const char *label1, *label2;
   svn_boolean_t mt1_binary = FALSE, mt2_binary = FALSE;
   const char *path1, *path2;
- int i;
+ apr_size_t len;
 
   /* Get a stream from our output file. */
   os = svn_stream_from_aprfile2(diff_cmd_baton->outfile, TRUE, subpool);
@@ -444,20 +444,10 @@
 
   path1 = diff_cmd_baton->orig_path_1;
   path2 = diff_cmd_baton->orig_path_2;
+ len = strlen(svn_path_get_longest_ancestor(path1, path2, subpool));
+ path1 = path1 + len;
+ path2 = path2 + len;
 
- for (i = 0; path1[i] && path2[i] && (path1[i] == path2[i]); i++)
- ;
-
- /* Make sure the prefix is made of whole components. (Issue #1771) */
- if (path1[i] || path2[i])
- {
- for ( ; (i > 0) && (path1[i] != '/'); i--)
- ;
- }
-
- path1 = path1 + i;
- path2 = path2 + i;
-
   /* ### Should diff labels print paths in local style? Is there
      already a standard for this? In any case, this code depends on
      a particular style, so not calling svn_path_local_style() on the

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-10-03 07:22:38 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.