Merge branch 'jk/format-patch-from'
authorJunio C Hamano <gitster@pobox.com>
Mon, 15 Jul 2013 17:28:39 +0000 (10:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Jul 2013 17:28:40 +0000 (10:28 -0700)
"git format-patch" learned "--from[=whom]" option, which sets the
"From: " header to the specified person (or the person who runs the
command, if "=whom" part is missing) and move the original author
information to an in-body From: header as necessary.

* jk/format-patch-from:
teach format-patch to place other authors into in-body "From"
pretty.c: drop const-ness from pretty_print_context

1  2 
commit.h
log-tree.c
diff --combined commit.h
index 18a523495eb7be3636f4f1311375fdb35329da9e,c56bc3a0914f9fce3e8b5d0a25d291077429fe03..35cc4e266bd4afe0e00d2efb2781db2e95906936
+++ b/commit.h
@@@ -6,6 -6,7 +6,7 @@@
  #include "strbuf.h"
  #include "decorate.h"
  #include "gpg-interface.h"
+ #include "string-list.h"
  
  struct commit_list {
        struct commit *item;
@@@ -79,6 -80,9 +80,9 @@@ enum cmit_fmt 
  };
  
  struct pretty_print_context {
+       /*
+        * Callers should tweak these to change the behavior of pp_* functions.
+        */
        enum cmit_fmt fmt;
        int abbrev;
        const char *subject;
        const char *output_encoding;
        struct string_list *mailmap;
        int color;
+       struct ident_split *from_ident;
+       /*
+        * Fields below here are manipulated internally by pp_* functions and
+        * should not be counted on by callers.
+        */
+       /* Manipulated by the pp_* functions internally. */
+       struct string_list in_body_headers;
  };
  
  struct userformat_want {
@@@ -111,20 -124,20 +124,20 @@@ extern void userformat_find_requirement
  extern void format_commit_message(const struct commit *commit,
                                  const char *format, struct strbuf *sb,
                                  const struct pretty_print_context *context);
- extern void pretty_print_commit(const struct pretty_print_context *pp,
+ extern void pretty_print_commit(struct pretty_print_context *pp,
                                const struct commit *commit,
                                struct strbuf *sb);
  extern void pp_commit_easy(enum cmit_fmt fmt, const struct commit *commit,
                           struct strbuf *sb);
- void pp_user_info(const struct pretty_print_context *pp,
+ void pp_user_info(struct pretty_print_context *pp,
                  const char *what, struct strbuf *sb,
                  const char *line, const char *encoding);
- void pp_title_line(const struct pretty_print_context *pp,
+ void pp_title_line(struct pretty_print_context *pp,
                   const char **msg_p,
                   struct strbuf *sb,
                   const char *encoding,
                   int need_8bit_cte);
- void pp_remainder(const struct pretty_print_context *pp,
+ void pp_remainder(struct pretty_print_context *pp,
                  const char **msg_p,
                  struct strbuf *sb,
                  int indent);
@@@ -254,6 -267,4 +267,6 @@@ extern void print_commit_list(struct co
   */
  extern void check_commit_signature(const struct commit* commit, struct signature_check *sigc);
  
 +int compare_commits_by_commit_date(const void *a_, const void *b_, void *unused);
 +
  #endif /* COMMIT_H */
diff --combined log-tree.c
index 60f32a3965feeba30bd7ba7ba724c5d7dfd52be8,67da27f909067132c79fdc028679895e280b7ab1..a49d8e895d3ad24f00e8504ec3eccfbddead6b4c
@@@ -617,7 -617,8 +617,9 @@@ void show_log(struct rev_info *opt
        ctx.fmt = opt->commit_format;
        ctx.mailmap = opt->mailmap;
        ctx.color = opt->diffopt.use_color;
 +      ctx.output_encoding = get_log_output_encoding();
+       if (opt->from_ident.mail_begin && opt->from_ident.name_begin)
+               ctx.from_ident = &opt->from_ident;
        pretty_print_commit(&ctx, commit, &msgbuf);
  
        if (opt->add_signoff)