Skip to content

Commit 45d93eb

Browse files
peffgitster
authored andcommitted
shortlog: change "author" variables to "ident"
We already match "committer", and we're about to start matching more things. Let's use a more neutral variable to avoid confusion. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 47ae905 commit 45d93eb

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

builtin/shortlog.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ static int compare_by_list(const void *a1, const void *a2)
4949
}
5050

5151
static void insert_one_record(struct shortlog *log,
52-
const char *author,
52+
const char *ident,
5353
const char *oneline)
5454
{
5555
struct string_list_item *item;
5656

57-
item = string_list_insert(&log->list, author);
57+
item = string_list_insert(&log->list, ident);
5858

5959
if (log->summary)
6060
item->util = (void *)(UTIL_TO_INT(item) + 1);
@@ -97,8 +97,8 @@ static void insert_one_record(struct shortlog *log,
9797
}
9898
}
9999

100-
static int parse_stdin_author(struct shortlog *log,
101-
struct strbuf *out, const char *in)
100+
static int parse_stdin_ident(struct shortlog *log,
101+
struct strbuf *out, const char *in)
102102
{
103103
const char *mailbuf, *namebuf;
104104
size_t namelen, maillen;
@@ -122,18 +122,18 @@ static int parse_stdin_author(struct shortlog *log,
122122

123123
static void read_from_stdin(struct shortlog *log)
124124
{
125-
struct strbuf author = STRBUF_INIT;
126-
struct strbuf mapped_author = STRBUF_INIT;
125+
struct strbuf ident = STRBUF_INIT;
126+
struct strbuf mapped_ident = STRBUF_INIT;
127127
struct strbuf oneline = STRBUF_INIT;
128128
static const char *author_match[2] = { "Author: ", "author " };
129129
static const char *committer_match[2] = { "Commit: ", "committer " };
130130
const char **match;
131131

132132
match = log->committer ? committer_match : author_match;
133-
while (strbuf_getline_lf(&author, stdin) != EOF) {
133+
while (strbuf_getline_lf(&ident, stdin) != EOF) {
134134
const char *v;
135-
if (!skip_prefix(author.buf, match[0], &v) &&
136-
!skip_prefix(author.buf, match[1], &v))
135+
if (!skip_prefix(ident.buf, match[0], &v) &&
136+
!skip_prefix(ident.buf, match[1], &v))
137137
continue;
138138
while (strbuf_getline_lf(&oneline, stdin) != EOF &&
139139
oneline.len)
@@ -142,20 +142,20 @@ static void read_from_stdin(struct shortlog *log)
142142
!oneline.len)
143143
; /* discard blanks */
144144

145-
strbuf_reset(&mapped_author);
146-
if (parse_stdin_author(log, &mapped_author, v) < 0)
145+
strbuf_reset(&mapped_ident);
146+
if (parse_stdin_ident(log, &mapped_ident, v) < 0)
147147
continue;
148148

149-
insert_one_record(log, mapped_author.buf, oneline.buf);
149+
insert_one_record(log, mapped_ident.buf, oneline.buf);
150150
}
151-
strbuf_release(&author);
152-
strbuf_release(&mapped_author);
151+
strbuf_release(&ident);
152+
strbuf_release(&mapped_ident);
153153
strbuf_release(&oneline);
154154
}
155155

156156
void shortlog_add_commit(struct shortlog *log, struct commit *commit)
157157
{
158-
struct strbuf author = STRBUF_INIT;
158+
struct strbuf ident = STRBUF_INIT;
159159
struct strbuf oneline = STRBUF_INIT;
160160
struct pretty_print_context ctx = {0};
161161
const char *fmt;
@@ -170,17 +170,17 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
170170
(log->email ? "%cN <%cE>" : "%cN") :
171171
(log->email ? "%aN <%aE>" : "%aN");
172172

173-
format_commit_message(commit, fmt, &author, &ctx);
173+
format_commit_message(commit, fmt, &ident, &ctx);
174174
if (!log->summary) {
175175
if (log->user_format)
176176
pretty_print_commit(&ctx, commit, &oneline);
177177
else
178178
format_commit_message(commit, "%s", &oneline, &ctx);
179179
}
180180

181-
insert_one_record(log, author.buf, oneline.len ? oneline.buf : "<none>");
181+
insert_one_record(log, ident.buf, oneline.len ? oneline.buf : "<none>");
182182

183-
strbuf_release(&author);
183+
strbuf_release(&ident);
184184
strbuf_release(&oneline);
185185
}
186186

0 commit comments

Comments
 (0)