From: Junio C Hamano Date: Tue, 19 Jul 2016 20:22:23 +0000 (-0700) Subject: Merge branch 'jk/write-file' X-Git-Tag: v2.10.0-rc0~102 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2b6456b8089e42232d80672525edbe411ba41549?hp=--cc Merge branch 'jk/write-file' General code clean-up around a helper function to write a single-liner to a file. * jk/write-file: branch: use write_file_buf instead of write_file use write_file_buf where applicable write_file: add format attribute write_file: add pointer+len variant write_file: use xopen write_file: drop "gently" form branch: use non-gentle write_file for branch description am: ignore return value of write_file() config: fix bogus fd check when setting up default config --- 2b6456b8089e42232d80672525edbe411ba41549 diff --cc builtin/branch.c index 12203fdcc8,1d41251a9a..bf0672578f --- a/builtin/branch.c +++ b/builtin/branch.c @@@ -614,14 -614,11 +614,11 @@@ static int edit_branch_description(cons if (!buf.len || buf.buf[buf.len-1] != '\n') strbuf_addch(&buf, '\n'); strbuf_commented_addf(&buf, - "Please edit the description for the branch\n" - " %s\n" - "Lines starting with '%c' will be stripped.\n", + _("Please edit the description for the branch\n" + " %s\n" + "Lines starting with '%c' will be stripped.\n"), branch_name, comment_line_char); - if (write_file_gently(git_path(edit_description), "%s", buf.buf)) { - strbuf_release(&buf); - return error_errno(_("could not write branch description template")); - } + write_file_buf(git_path(edit_description), buf.buf, buf.len); strbuf_reset(&buf); if (launch_editor(git_path(edit_description), &buf, NULL)) { strbuf_release(&buf);