Download raw body.
vi struggling to save commit messages
On Wed, 08 Mar 2023 22:19:35 +0100, Stefan Sperling wrote: > I can reproduce this with Vim on an NFS share between two amd64 systems. > > Running fsync() before starting the editor fixes it for me. It should be sufficient to just close the fd first. - todd diff --git a/got/got.c b/got/got.c index e95ba293..5351526e 100644 --- a/got/got.c +++ b/got/got.c @@ -518,6 +518,11 @@ collect_import_msg(char **logmsg, char **logmsg_path, const char *editor, err = got_error_from_errno2("write", *logmsg_path); goto done; } + if (close(fd) == -1) { + err = got_error_from_errno2("close", *logmsg_path); + goto done; + } + fd = -1; err = edit_logmsg(logmsg, editor, *logmsg_path, initial_content, initial_content_len, 1); @@ -7407,6 +7412,11 @@ get_tag_message(char **tagmsg, char **tagmsg_path, const char *commit_id_str, err = got_error_from_errno2("write", *tagmsg_path); goto done; } + if (close(fd) == -1) { + err = got_error_from_errno2("close", *tagmsg_path); + goto done; + } + fd = -1; err = get_editor(&editor); if (err) @@ -8912,6 +8922,12 @@ collect_commit_logmsg(struct got_pathlist_head *commitable_paths, diff_path); } + if (close(fd) == -1) { + err = got_error_from_errno2("close", a->logmsg_path); + goto done; + } + fd = -1; + err = edit_logmsg(logmsg, a->editor, a->logmsg_path, initial_content, initial_content_len, a->prepared_log ? 0 : 1); done:
vi struggling to save commit messages