Code

Merge branch 'uk/maint-shortlog-encoding'
authorJunio C Hamano <gitster@pobox.com>
Mon, 30 Nov 2009 22:42:28 +0000 (14:42 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Nov 2009 22:42:28 +0000 (14:42 -0800)
Conflicts:
builtin-shortlog.c

1  2 
builtin-shortlog.c

index 8aa63c7857fb3a704826bf223ddefb3e40f0eaf7,b98edc3ba6c155b632d5e140d0b5a3e8a2d4eb9b..b3b055f68ce59b6b91ef6949bd8c4bd0bed68b55
@@@ -139,8 -139,12 +139,12 @@@ static void read_from_stdin(struct shor
  void shortlog_add_commit(struct shortlog *log, struct commit *commit)
  {
        const char *author = NULL, *buffer;
+       struct strbuf buf = STRBUF_INIT;
+       struct strbuf ufbuf = STRBUF_INIT;
++      struct pretty_print_context ctx = {0};
  
-       buffer = commit->buffer;
 -      pretty_print_commit(CMIT_FMT_RAW, commit, &buf,
 -                          0, NULL, NULL, DATE_NORMAL, 0);
++      pretty_print_commit(CMIT_FMT_RAW, commit, &buf, &ctx);
+       buffer = buf.buf;
        while (*buffer && *buffer != '\n') {
                const char *eol = strchr(buffer, '\n');
  
                die("Missing author: %s",
                    sha1_to_hex(commit->object.sha1));
        if (log->user_format) {
-               struct strbuf buf = STRBUF_INIT;
 -              pretty_print_commit(CMIT_FMT_USERFORMAT, commit, &ufbuf,
 -                      DEFAULT_ABBREV, "", "", DATE_NORMAL, 0);
 +              struct pretty_print_context ctx = {0};
 +              ctx.abbrev = DEFAULT_ABBREV;
 +              ctx.subject = "";
 +              ctx.after_subject = "";
 +              ctx.date_mode = DATE_NORMAL;
-               pretty_print_commit(CMIT_FMT_USERFORMAT, commit, &buf, &ctx);
-               insert_one_record(log, author, buf.buf);
-               strbuf_release(&buf);
-               return;
-       }
-       if (*buffer)
++              pretty_print_commit(CMIT_FMT_USERFORMAT, commit, &ufbuf, &ctx);
+               buffer = ufbuf.buf;
+       } else if (*buffer) {
                buffer++;
+       }
        insert_one_record(log, author, !*buffer ? "<none>" : buffer);
+       strbuf_release(&ufbuf);
+       strbuf_release(&buf);
  }
  
  static void get_from_rev(struct rev_info *rev, struct shortlog *log)