[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: Neels J Hofmeyr <neels_at_elego.de>
Date: Sun, 05 Oct 2008 01:41:25 +0200

Looks good to me.

Thanks!
~Neels

Karl Fogel wrote:
> 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
>

-- 
Neels Hofmeyr -- elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Gebäude 12, 13355 Berlin, Germany
phone: +49 30 23458696  mobile: +49 177 2345869  fax: +49 30 23458695
http://www.elegosoft.com | Geschäftsführer: Olaf Wagner | Sitz: Berlin
Handelsreg: Amtsgericht Charlottenburg HRB 77719 | USt-IdNr: DE163214194

Received on 2008-10-05 18:19:41 CEST

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