commit 71392a05f2ee999ddda39f6b5eb64d0bc292c0ce from: Stefan Sperling date: Sun Dec 13 11:43:41 2020 UTC prevent log message loss of folded commits during histedit If the histedit log message editor exits without saving its buffer, Got threw away log messages of all commits which were folded. Only the last commit message is preserved, which could be something meaningless like "fixup". Instead, preserve the initial editor buffer content as-is. That is not going to be an ideal log message, but doesn't throw away information and stands out visually because the newly created log message will start with a comment like '# log message of folded commit a0ff...' Problem reported by jrick commit - b380533788adf056655d5bdf9d7e497e53c5d85f commit + 71392a05f2ee999ddda39f6b5eb64d0bc292c0ce blob - 4df2db7f021912a09dd421ede13f9b680c18aa24 blob + 6d427879bfb75db1dd06c1c4b0eb326ddd18ffc0 --- got/got.c +++ got/got.c @@ -8024,7 +8024,10 @@ histedit_edit_logmsg(struct got_histedit_list_entry *h if (err) { if (err->code != GOT_ERR_COMMIT_MSG_EMPTY) goto done; - err = got_object_commit_get_logmsg(&hle->logmsg, commit); + err = NULL; + hle->logmsg = strdup(new_msg); + if (hle->logmsg == NULL) + err = got_error_from_errno("strdup"); } done: if (logmsg_path && unlink(logmsg_path) != 0 && err == NULL)