subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bert Huijben" <b...@qqmail.nl>
Subject RE: svn commit: r1723385 - in /subversion/trunk/subversion: libsvn_client/relocate.c tests/cmdline/relocate_tests.py
Date Wed, 06 Jan 2016 17:43:01 GMT


> -----Original Message-----
> From: philip@apache.org [mailto:philip@apache.org]
> Sent: woensdag 6 januari 2016 18:20
> To: commits@subversion.apache.org
> Subject: svn commit: r1723385 - in /subversion/trunk/subversion:
> libsvn_client/relocate.c tests/cmdline/relocate_tests.py
> 
> Author: philip
> Date: Wed Jan  6 17:20:28 2016
> New Revision: 1723385
> 
> URL: http://svn.apache.org/viewvc?rev=1723385&view=rev
> Log:
> Fix a problem relocating some externals.
> 
> Reported by: Larry Baird <lab{_AT_}gta.com>
> 
> * subversion/libsvn_client/relocate.c
>   (svn_client_relocate2): Handle case where prefix is too long
>    to be valid for externals.
> 
> * subversion/tests/cmdline/relocate_tests.py
>   (relocate_with_relative_externals): Extend.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_client/relocate.c
>     subversion/trunk/subversion/tests/cmdline/relocate_tests.py
> 
> Modified: subversion/trunk/subversion/libsvn_client/relocate.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/re
> locate.c?rev=1723385&r1=1723384&r2=1723385&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_client/relocate.c (original)
> +++ subversion/trunk/subversion/libsvn_client/relocate.c Wed Jan  6
> 17:20:28 2016
> @@ -141,6 +141,8 @@ svn_client_relocate2(const char *wcroot_
>    apr_hash_index_t *hi;
>    apr_pool_t *iterpool = NULL;
>    const char *old_repos_root_url, *new_repos_root_url;
> +  char *sig_from_prefix, *sig_to_prefix;
> +  apr_size_t index_from, index_to;
> 
>    /* Populate our validator callback baton, and call the relocate code. */
>    vb.ctx = ctx;
> @@ -183,6 +185,21 @@ svn_client_relocate2(const char *wcroot_
>    if (! apr_hash_count(externals_hash))
>      return SVN_NO_ERROR;
> 
> +  /* A valid prefix for the main working copy may be too long to be
> +     valid for an external.  Trim any common trailing characters to
> +     leave the significant part that changes. */
> +  sig_from_prefix = apr_pstrdup(pool, from_prefix);
> +  sig_to_prefix = apr_pstrdup(pool, to_prefix);
> +  index_from = strlen(sig_from_prefix);
> +  index_to = strlen(sig_to_prefix);
> +  while (index_from && index_to
> +         && sig_from_prefix[index_from] == sig_to_prefix[index_to])
> +    {
> +      sig_from_prefix[index_from] = sig_to_prefix[index_to] = '\0';
> +      --index_from;
> +      --index_to;
> +    }
> +

I'm wondering, is it safe to do this this way... or should we use the safer svn_uri_dirname()
to split of whole components from a url at a time. 

Are there cases where this might match half a directory (or host) name?

	Bert 


Mime
View raw message