git-show-ref: fix escaping in asciidoc source
[gitweb.git] / builtin / log.c
index 27849dc91de03a46d4c9357ca0d7b3f79188cc98..5c2af590047d92554d87acc5d7113a2f1f730a96 100644 (file)
@@ -107,6 +107,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
                             PARSE_OPT_KEEP_DASHDASH);
 
        argc = setup_revisions(argc, argv, rev, opt);
+       if (quiet)
+               rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT;
 
        /* Any arguments at this point are not recognized */
        if (argc > 1)
@@ -374,9 +376,11 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
 static void show_tagger(char *buf, int len, struct rev_info *rev)
 {
        struct strbuf out = STRBUF_INIT;
+       struct pretty_print_context pp = {0};
 
-       pp_user_info("Tagger", rev->commit_format, &out, buf, rev->date_mode,
-               get_log_output_encoding());
+       pp.fmt = rev->commit_format;
+       pp.date_mode = rev->date_mode;
+       pp_user_info(&pp, "Tagger", &out, buf, get_log_output_encoding());
        printf("%s", out.buf);
        strbuf_release(&out);
 }
@@ -760,10 +764,8 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
                              int quiet)
 {
        const char *committer;
-       const char *subject_start = NULL;
        const char *body = "*** SUBJECT HERE ***\n\n*** BLURB HERE ***\n";
        const char *msg;
-       const char *extra_headers = rev->extra_headers;
        struct shortlog log;
        struct strbuf sb = STRBUF_INIT;
        int i;
@@ -771,6 +773,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
        struct diff_options opts;
        int need_8bit_cte = 0;
        struct commit *commit = NULL;
+       struct pretty_print_context pp = {0};
 
        if (rev->commit_format != CMIT_FMT_EMAIL)
                die(_("Cover letter needs email format"));
@@ -802,7 +805,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
                free(commit);
        }
 
-       log_write_email_headers(rev, head, &subject_start, &extra_headers,
+       log_write_email_headers(rev, head, &pp.subject, &pp.after_subject,
                                &need_8bit_cte);
 
        for (i = 0; !need_8bit_cte && i < nr; i++)
@@ -810,11 +813,11 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
                        need_8bit_cte = 1;
 
        msg = body;
-       pp_user_info(NULL, CMIT_FMT_EMAIL, &sb, committer, DATE_RFC2822,
-                    encoding);
-       pp_title_line(CMIT_FMT_EMAIL, &msg, &sb, subject_start, extra_headers,
-                     encoding, need_8bit_cte);
-       pp_remainder(CMIT_FMT_EMAIL, &msg, &sb, 0);
+       pp.fmt = CMIT_FMT_EMAIL;
+       pp.date_mode = DATE_RFC2822;
+       pp_user_info(&pp, NULL, &sb, committer, encoding);
+       pp_title_line(&pp, &msg, &sb, encoding, need_8bit_cte);
+       pp_remainder(&pp, &msg, &sb, 0);
        printf("%s\n", sb.buf);
 
        strbuf_release(&sb);
@@ -1178,6 +1181,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                die (_("-n and -k are mutually exclusive."));
        if (keep_subject && subject_prefix)
                die (_("--subject-prefix and -k are mutually exclusive."));
+       rev.preserve_subject = keep_subject;
 
        argc = setup_revisions(argc, argv, &rev, &s_r_opt);
        if (argc > 1)
@@ -1408,8 +1412,7 @@ static void print_commit(char sign, struct commit *commit, int verbose,
                       find_unique_abbrev(commit->object.sha1, abbrev));
        } else {
                struct strbuf buf = STRBUF_INIT;
-               struct pretty_print_context ctx = {0};
-               pretty_print_commit(CMIT_FMT_ONELINE, commit, &buf, &ctx);
+               pp_commit_easy(CMIT_FMT_ONELINE, commit, &buf);
                printf("%c %s %s\n", sign,
                       find_unique_abbrev(commit->object.sha1, abbrev),
                       buf.buf);