branch: use non-gentle write_file for branch description

We use write_file_gently() to do this job currently. However, if we see an error, we simply complain via error_errno() and then end up exiting with an error code. By switching to the non-gentle form, the function will die for us, with a better error. It is more specific about which syscall caused the error, and that mentions the actual filename we're trying to write. Our exit code for the error case does switch from "1" to "128", but that's OK; it wasn't a meaningful documented code (and in fact it was odd that it was a different exit code than most other error conditions). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jul 8, 2016 at 05:08 UTC 3d75bba28d8665ec43f1faffce38d5817c77ebe8
1 file changed +1 -4
builtin/branch.c
+1 -4
@@ -618,10 +618,7 @@ static int edit_branch_description(const char *branch_name)
618 " %s\n"
619 "Lines starting with '%c' will be stripped.\n",
620 branch_name, comment_line_char);
621 - if (write_file_gently(git_path(edit_description), "%s", buf.buf)) {
622 - strbuf_release(&buf);
623 - return error_errno(_("could not write branch description template"));
624 - }
621 + write_file(git_path(edit_description), "%s", buf.buf);
622 strbuf_reset(&buf);
623 if (launch_editor(git_path(edit_description), &buf, NULL)) {
624 strbuf_release(&buf);