Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r12 - in trunk: . fsvs/src

fsvs
Discussion topic

Hide all messages in topic

All messages in topic

svn commit: r12 - in trunk: . fsvs/src

Author pmarek
Full name P.Marek
Date 2005-10-04 23:00:03 PDT
Message Author: pmarek
Date: Tue Oct 4 23:00:02 2005
New Revision: 12

Modified:
   trunk/ (props changed)
   trunk/fsvs/src/commit.c
Log:
commit: should do an abort_edit if an error occurs



Modified: trunk/fsvs/src/commit.c
Url: http://fsvs.tigris.o​rg/source/browse/fsv​s/trunk/fsvs/src/com​mit.c?view=diff&​rev=12&p1=trunk/​fsvs/src/commit.c​&r1=11&p2=trunk​/fsvs/src/commit.c​&r2=12
====================​====================​====================​==================
--- trunk/fsvs/src/commit.c (original)
+++ trunk/fsvs/src/commit.c Tue Oct 4 23:00:02 2005
@@ -383,13 +383,14 @@
     int status;
     svn_error_t *status_svn;
     const svn_delta_editor_t *editor;
- void *edit_baton;
+ void *edit_baton, *edit_copy;
     void *root_baton;
     struct stat64 st;
 
 
     status=0;
     status_svn=NULL;
+ edit_baton=NULL;
     if (opt_commitmsgfile)
     {
         STOPIF_CODE_ERR( fstat64(commitmsg_fh, &st) == -1, errno,
@@ -428,17 +429,28 @@
     STOPIF_SVNERR( ac__commit_dir,
             (editor, root, root_baton, pool));
 
- STOPIF_SVNERR( editor->close_edit,
- (edit_baton, pool) );
-
 ex:
     STOP_HANDLE_SVNERR(status_svn);
 
- /* has to write new file */
+ex2:
+ if (edit_baton)
+ {
+ edit_copy=edit_baton;
+ edit_baton=NULL;
+
+ /* If there has already something bad happenend, it probably
+ * makes no sense in checking the error code.
+ * On the needed close_edit it's the Right Thing To Do (tm) */
+ if (status)
+ editor->abort_edi​t(edit_copy, pool);
+ else
+ STOPIF_SVNERR( editor->close_edit, (edit_copy, pool) );
+ }
+
+ /* Has to write new file, if commit succeeded. */
     if (!status)
         STOPIF( waa__output_tree(root), NULL);
 
-ex2:
     return status;
 }
Messages per page: