]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/write-file'
authorJunio C Hamano <gitster@pobox.com>
Tue, 19 Jul 2016 20:22:23 +0000 (13:22 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Jul 2016 20:22:23 +0000 (13:22 -0700)
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

1  2 
builtin/am.c
builtin/branch.c
builtin/merge.c
cache.h
wrapper.c

diff --cc builtin/am.c
Simple merge
index 12203fdcc8179a41ba43ee87eb8f906bc45380e3,1d41251a9a86a2533b550842b0c9500e61265492..bf0672578f3b1a875b7cc691a27f77e96f394909
@@@ -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);
diff --cc builtin/merge.c
Simple merge
diff --cc cache.h
Simple merge
diff --cc wrapper.c
Simple merge