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
  • s Daniel Shahaf

Reply via email to