Merge branch 'rs/show-branch-argv-array' into maint
[gitweb.git] / builtin / commit.c
index 63772d016a23905d2e58bff0ad117673ed6651e7..f2a8b78c7a7c5f52c46e03e644cf50413b643d3e 100644 (file)
@@ -32,6 +32,7 @@
 #include "sequencer.h"
 #include "notes-utils.h"
 #include "mailmap.h"
+#include "sigchain.h"
 
 static const char * const builtin_commit_usage[] = {
        N_("git commit [<options>] [--] <pathspec>..."),
@@ -775,7 +776,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
        s->hints = 0;
 
        if (clean_message_contents)
-               stripspace(&sb, 0);
+               strbuf_stripspace(&sb, 0);
 
        if (signoff)
                append_signoff(&sb, ignore_non_trailer(&sb), 0);
@@ -1014,7 +1015,7 @@ static int template_untouched(struct strbuf *sb)
        if (!template_file || strbuf_read_file(&tmpl, template_file, 0) <= 0)
                return 0;
 
-       stripspace(&tmpl, cleanup_mode == CLEANUP_ALL);
+       strbuf_stripspace(&tmpl, cleanup_mode == CLEANUP_ALL);
        if (!skip_prefix(sb->buf, tmpl.buf, &start))
                start = sb->buf;
        strbuf_release(&tmpl);
@@ -1537,8 +1538,10 @@ static int run_rewrite_hook(const unsigned char *oldsha1,
                return code;
        n = snprintf(buf, sizeof(buf), "%s %s\n",
                     sha1_to_hex(oldsha1), sha1_to_hex(newsha1));
+       sigchain_push(SIGPIPE, SIG_IGN);
        write_in_full(proc.in, buf, n);
        close(proc.in);
+       sigchain_pop(SIGPIPE);
        return finish_command(&proc);
 }
 
@@ -1726,7 +1729,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
                wt_status_truncate_message_at_cut_line(&sb);
 
        if (cleanup_mode != CLEANUP_NONE)
-               stripspace(&sb, cleanup_mode == CLEANUP_ALL);
+               strbuf_stripspace(&sb, cleanup_mode == CLEANUP_ALL);
        if (template_untouched(&sb) && !allow_empty_message) {
                rollback_index_files();
                fprintf(stderr, _("Aborting commit; you did not edit the message.\n"));