Author: stsp Date: Thu Sep 27 14:15:43 2012 New Revision: 1391020 URL: http://svn.apache.org/viewvc?rev=1391020&view=rev Log: Fix issue #4234, "svndumpfilter exclude --targets wants pathname to start with '/'"
* subversion/svndumpfilter/main.c (main): While parsing through the 'targets' file, check for a leading slash('/') in every path prefix. If it is not there, prepend a '/'. Found by: Jeyanthan <jeyanthan{_AT_}collab.net> Patch by: Vijayaguru G <vijay{_AT_}collab.net> (Tweaked by me to avoid shadowed declaration of local variable 'i'.) Modified: subversion/trunk/subversion/svndumpfilter/main.c Modified: subversion/trunk/subversion/svndumpfilter/main.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svndumpfilter/main.c?rev=1391020&r1=1391019&r2=1391020&view=diff ============================================================================== --- subversion/trunk/subversion/svndumpfilter/main.c (original) +++ subversion/trunk/subversion/svndumpfilter/main.c Thu Sep 27 14:15:43 2012 @@ -1526,6 +1526,8 @@ main(int argc, const char *argv[]) { svn_stringbuf_t *buffer, *buffer_utf8; const char *utf8_targets_file; + apr_array_header_t *targets = apr_array_make(pool, 0, + sizeof(const char *)); /* We need to convert to UTF-8 now, even before we divide the targets into an array, because otherwise we wouldn't @@ -1538,10 +1540,18 @@ main(int argc, const char *argv[]) pool)); SVN_INT_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool)); - opt_state.prefixes = apr_array_append(pool, - svn_cstring_split(buffer_utf8->data, "\n\r", - TRUE, pool), - opt_state.prefixes); + targets = apr_array_append(pool, + svn_cstring_split(buffer_utf8->data, "\n\r", + TRUE, pool), + targets); + + for (i = 0; i < targets->nelts; i++) + { + const char *prefix = APR_ARRAY_IDX(targets, i, const char *); + if (prefix[0] != '/') + prefix = apr_pstrcat(pool, "/", prefix, (char *)NULL); + APR_ARRAY_PUSH(opt_state.prefixes, const char *) = prefix; + } } if (apr_is_empty_array(opt_state.prefixes))