You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Shahaf <d....@daniel.shahaf.name> on 2011/02/07 02:18:58 UTC

s

I managed to cause 'svn' to lose my commit message when (for whatever
reason) Vim exited with error code 2 after I'd saved the file:
[[[
subversion/svn/commit-cmd.c:154: (apr_err=200012)
subversion/libsvn_client/commit.c:845: (apr_err=200012)
svn: Commit failed (details follow):
subversion/svn/util.c:820: (apr_err=200012)
subversion/svn/util.c:529: (apr_err=200012)
subversion/svn/util.c:451: (apr_err=200012)
svn: system('vim svn-commit.tmp') returned 2
zsh: exit 1     $svn ci subversion/*ff
]]]

This seems to fix that:
[[[
Index: subversion/svn/util.c
===================================================================
--- subversion/svn/util.c	(revision 1067832)
+++ subversion/svn/util.c	(working copy)
@@ -438,11 +438,21 @@ svn_cl__edit_string_externally
       goto cleanup;
     }
 
-  /* Now, run the editor command line.  */
+  /* Prepare the editor command line.  */
   err = svn_utf_cstring_from_utf8(&tmpfile_native, tmpfile_name, pool);
   if (err)
     goto cleanup;
   cmd = apr_psprintf(pool, "%s %s", editor, tmpfile_native);
+
+  /* If the caller wants us to leave the file around, return the path
+     of the file we'll use, and make a note not to destroy it.  */
+  if (tmpfile_left)
+    {
+      *tmpfile_left = svn_dirent_join(base_dir, tmpfile_name, pool);
+      remove_file = FALSE;
+    }
+
+  /* Now, run the editor command line.  */
   sys_err = system(cmd);
   if (sys_err != 0)
     {
@@ -462,14 +472,6 @@
       goto cleanup;
     }
 
-  /* If the caller wants us to leave the file around, return the path
-     of the file we used, and make a note not to destroy it.  */
-  if (tmpfile_left)
-    {
-      *tmpfile_left = svn_dirent_join(base_dir, tmpfile_name, pool);
-      remove_file = FALSE;
-    }
-
   /* If the file looks changed... */
   if ((finfo_before.mtime != finfo_after.mtime) ||
       (finfo_before.size != finfo_after.size))
]]]

I'll test + commit in a few days.

Daniel

Re: s

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
C. Michael Pilato wrote on Thu, Feb 10, 2011 at 14:42:26 -0500:
> On 02/06/2011 08:18 PM, Daniel Shahaf wrote:
> > I managed to cause 'svn' to lose my commit message when (for whatever
> > reason) Vim exited with error code 2 after I'd saved the file:
> 
> I've read through the code a few times now, and I can't see a good reason
> not to commit this.  (But I'll defer that act to you.)

Thanks for the review; r1072084 and nominated for backport.

Re: s

Posted by "C. Michael Pilato" <cm...@collab.net>.
On 02/06/2011 08:18 PM, Daniel Shahaf wrote:
> I managed to cause 'svn' to lose my commit message when (for whatever
> reason) Vim exited with error code 2 after I'd saved the file:

I've read through the code a few times now, and I can't see a good reason
not to commit this.  (But I'll defer that act to you.)

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand