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

[PATCH] possible fix for issue 565

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2002-01-13 05:19:01 CET

so i'm working on issue 565, which has to do with svn commit
<filename> failing after svn rming a file then actually deleting the
file.

we fail to commit because inside svn_path_condense_targets there is a
svn_path_split_if_file call that takes pbasedir, which happens to be
(at thet point), derived from the filename that was passed on the
command line.

now from what i can tell, not erroring out if that
svn_path_split_if_file call fails doesn't seem to have any negative
effects. as long as we're careful to avoid the attempt to add the
result of that function (a filename) to the pcondensed_targets array,
everything seems to work fine. the case mentioned in the issue now
works, and the rest of the test suite passes just fine.

i'm not sure if this is the correct fix, but i'm including it, along
with a log message, so someone who understands more about how this all
works can verify wether it's right or not.

if i can get an ok on the change, i'll put together a test case for it
(actually, i'll start on that now anyway, since we'll need it
eventually...)

-garrett

Fix issue 565, an error during commit when a file that was svn rm'd
is physically deleted before the commit.

* subversion/libsvn_subr/target.c
  (svn_path_condense_targets): don't error out if svn_path_split_if_file
  fails, as that causes us to fail to commit changes in the case where a
  file is svn rm'd and then actually deleted before the commit occurs,
  and its results don't seem to be strictly necessary.

Index: ./subversion/libsvn_subr/target.c
===================================================================
--- ./subversion/libsvn_subr/target.c
+++ ./subversion/libsvn_subr/target.c Sat Jan 12 22:54:41 2002
@@ -99,6 +99,8 @@
                            enum svn_path_style style,
                            apr_pool_t *pool)
 {
+ svn_error_t *err;
+
   if (targets->nelts <=0)
     {
       *pbasedir = NULL;
@@ -222,16 +224,17 @@
                 = svn_stringbuf_create (rel_item, pool);
             }
         }
-
+
       /* Finally check if pbasedir is a dir or a file. */
- SVN_ERR (svn_path_split_if_file (*pbasedir, pbasedir, &file, pool));
- if ((pcondensed_targets != NULL)
- && (! svn_path_is_empty (file, svn_path_local_style)))
- {
- /* If there was just one target, and it was a file, then
- return it as the sole condensed target. */
- (*((svn_stringbuf_t**)apr_array_push (*pcondensed_targets))) = file;
- }
+ err = svn_path_split_if_file (*pbasedir, pbasedir, &file, pool);
+ if (err == SVN_NO_ERROR)
+ if ((pcondensed_targets != NULL)
+ && (! svn_path_is_empty (file, svn_path_local_style)))
+ {
+ /* If there was just one target, and it was a file, then
+ return it as the sole condensed target. */
+ (*((svn_stringbuf_t**)apr_array_push (*pcondensed_targets))) = file;
+ }
     }
   
   return SVN_NO_ERROR;

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:56 2006

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.