]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pretty.c
t: convert egrep usage to "grep -E"
[thirdparty/git.git] / pretty.c
index 6d819103fbf1db3a201f993e20140bfa288a0e12..6cb363ae1c9e90e47e2002fb7e89a1f03a12f23c 100644 (file)
--- a/pretty.c
+++ b/pretty.c
@@ -43,7 +43,8 @@ static void save_user_format(struct rev_info *rev, const char *cp, int is_tforma
        rev->commit_format = CMIT_FMT_USERFORMAT;
 }
 
-static int git_pretty_formats_config(const char *var, const char *value, void *cb)
+static int git_pretty_formats_config(const char *var, const char *value,
+                                    void *cb UNUSED)
 {
        struct cmt_fmt_map *commit_format = NULL;
        const char *name;
@@ -477,6 +478,16 @@ end:
        }
 }
 
+static int use_in_body_from(const struct pretty_print_context *pp,
+                           const struct ident_split *ident)
+{
+       if (pp->rev && pp->rev->force_in_body_from)
+               return 1;
+       if (ident_cmp(pp->from_ident, ident))
+               return 1;
+       return 0;
+}
+
 void pp_user_info(struct pretty_print_context *pp,
                  const char *what, struct strbuf *sb,
                  const char *line, const char *encoding)
@@ -503,7 +514,7 @@ void pp_user_info(struct pretty_print_context *pp,
                map_user(pp->mailmap, &mailbuf, &maillen, &namebuf, &namelen);
 
        if (cmit_fmt_is_mail(pp->fmt)) {
-               if (pp->from_ident && ident_cmp(pp->from_ident, &ident)) {
+               if (pp->from_ident && use_in_body_from(pp, &ident)) {
                        struct strbuf buf = STRBUF_INIT;
 
                        strbuf_addstr(&buf, "From: ");