This is in preparation for shortlog counting more things
than just authors. Breaking it out into a separate patch
keeps the noise down when the real changes come.

Signed-off-by: Jeff King <p...@peff.net>
---
 builtin/shortlog.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 7ec6b76..d7eb0cb 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -47,7 +47,7 @@ static int compare_by_list(const void *a1, const void *a2)
 }
 
 static void insert_one_record(struct shortlog *log,
-                             const char *author,
+                             const char *ident_string,
                              const char *oneline)
 {
        struct string_list_item *item;
@@ -56,7 +56,7 @@ static void insert_one_record(struct shortlog *log,
        struct strbuf namemailbuf = STRBUF_INIT;
        struct ident_split ident;
 
-       if (split_ident_line(&ident, author, strlen(author)))
+       if (split_ident_line(&ident, ident_string, strlen(ident_string)))
                return;
 
        namebuf = ident.name_begin;
@@ -115,12 +115,12 @@ static void insert_one_record(struct shortlog *log,
 
 static void read_from_stdin(struct shortlog *log)
 {
-       struct strbuf author = STRBUF_INIT;
+       struct strbuf ident = STRBUF_INIT;
        struct strbuf oneline = STRBUF_INIT;
 
-       while (strbuf_getline(&author, stdin, '\n') != EOF) {
+       while (strbuf_getline(&ident, stdin, '\n') != EOF) {
                const char *v;
-               if (!skip_prefix_icase(author.buf, "Author: ", &v))
+               if (!skip_prefix_icase(ident.buf, "Author: ", &v))
                        continue;
                while (strbuf_getline(&oneline, stdin, '\n') != EOF &&
                       oneline.len)
@@ -130,13 +130,13 @@ static void read_from_stdin(struct shortlog *log)
                        ; /* discard blanks */
                insert_one_record(log, v, oneline.buf);
        }
-       strbuf_release(&author);
+       strbuf_release(&ident);
        strbuf_release(&oneline);
 }
 
 void shortlog_add_commit(struct shortlog *log, struct commit *commit)
 {
-       struct strbuf author = STRBUF_INIT;
+       struct strbuf ident = STRBUF_INIT;
        struct strbuf oneline = STRBUF_INIT;
        struct pretty_print_context ctx = {0};
 
@@ -147,8 +147,8 @@ void shortlog_add_commit(struct shortlog *log, struct 
commit *commit)
        ctx.date_mode.type = DATE_NORMAL;
        ctx.output_encoding = get_log_output_encoding();
 
-       format_commit_message(commit, "%an <%ae>", &author, &ctx);
-       if (author.len <= 3) {
+       format_commit_message(commit, "%an <%ae>", &ident, &ctx);
+       if (ident.len <= 3) {
                warning(_("Missing author: %s"),
                    oid_to_hex(&commit->object.oid));
                return;
@@ -161,8 +161,8 @@ void shortlog_add_commit(struct shortlog *log, struct 
commit *commit)
                        format_commit_message(commit, "%s", &oneline, &ctx);
        }
 
-       insert_one_record(log, author.buf, oneline.len ? oneline.buf : 
"<none>");
-       strbuf_release(&author);
+       insert_one_record(log, ident.buf, oneline.len ? oneline.buf : "<none>");
+       strbuf_release(&ident);
        strbuf_release(&oneline);
 }
 
-- 
2.7.0.rc3.367.g09631da

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to