]> git.ipfire.org Git - thirdparty/git.git/blame - fmt-merge-msg.c
Merge branch 'rj/add-i-leak-fix'
[thirdparty/git.git] / fmt-merge-msg.c
CommitLineData
e93fc5d7 1#include "git-compat-util.h"
ce6521e4 2#include "config.h"
7ee24e18 3#include "environment.h"
ce6521e4 4#include "refs.h"
dabab1d6 5#include "object-name.h"
a034e910 6#include "object-store-ll.h"
ce6521e4 7#include "diff.h"
09322b1d 8#include "diff-merges.h"
41771fa4 9#include "hex.h"
ce6521e4
DL
10#include "revision.h"
11#include "tag.h"
12#include "string-list.h"
13#include "branch.h"
14#include "fmt-merge-msg.h"
15#include "commit-reach.h"
9d12546d 16#include "gpg-interface.h"
dd77d587 17#include "wildmatch.h"
ce6521e4
DL
18
19static int use_branch_desc;
6e6029a8
JH
20static int suppress_dest_pattern_seen;
21static struct string_list suppress_dest_patterns = STRING_LIST_INIT_DUP;
ce6521e4 22
a4e7e317
GC
23int fmt_merge_msg_config(const char *key, const char *value,
24 const struct config_context *ctx, void *cb)
ce6521e4
DL
25{
26 if (!strcmp(key, "merge.log") || !strcmp(key, "merge.summary")) {
27 int is_bool;
8868b1eb 28 merge_log_config = git_config_bool_or_int(key, value, ctx->kvi, &is_bool);
ce6521e4
DL
29 if (!is_bool && merge_log_config < 0)
30 return error("%s: negative length %s", key, value);
31 if (is_bool && merge_log_config)
32 merge_log_config = DEFAULT_MERGE_LOG_LEN;
33 } else if (!strcmp(key, "merge.branchdesc")) {
34 use_branch_desc = git_config_bool(key, value);
6e6029a8
JH
35 } else if (!strcmp(key, "merge.suppressdest")) {
36 if (!value)
37 return config_error_nonbool(key);
38 if (!*value)
39 string_list_clear(&suppress_dest_patterns, 0);
40 else
41 string_list_append(&suppress_dest_patterns, value);
42 suppress_dest_pattern_seen = 1;
ce6521e4 43 } else {
a4e7e317 44 return git_default_config(key, value, ctx, cb);
ce6521e4
DL
45 }
46 return 0;
47}
48
49/* merge data per repository where the merged tips came from */
50struct src_data {
51 struct string_list branch, tag, r_branch, generic;
52 int head_status;
53};
54
55struct origin_data {
56 struct object_id oid;
57 unsigned is_local_branch:1;
58};
59
60static void init_src_data(struct src_data *data)
61{
62 data->branch.strdup_strings = 1;
63 data->tag.strdup_strings = 1;
64 data->r_branch.strdup_strings = 1;
65 data->generic.strdup_strings = 1;
66}
67
68static struct string_list srcs = STRING_LIST_INIT_DUP;
69static struct string_list origins = STRING_LIST_INIT_DUP;
70
71struct merge_parents {
72 int alloc, nr;
73 struct merge_parent {
74 struct object_id given;
75 struct object_id commit;
76 unsigned char used;
77 } *item;
78};
79
80/*
81 * I know, I know, this is inefficient, but you won't be pulling and merging
82 * hundreds of heads at a time anyway.
83 */
84static struct merge_parent *find_merge_parent(struct merge_parents *table,
85 struct object_id *given,
86 struct object_id *commit)
87{
88 int i;
89 for (i = 0; i < table->nr; i++) {
90 if (given && !oideq(&table->item[i].given, given))
91 continue;
92 if (commit && !oideq(&table->item[i].commit, commit))
93 continue;
94 return &table->item[i];
95 }
96 return NULL;
97}
98
99static void add_merge_parent(struct merge_parents *table,
100 struct object_id *given,
101 struct object_id *commit)
102{
103 if (table->nr && find_merge_parent(table, given, commit))
104 return;
105 ALLOC_GROW(table->item, table->nr + 1, table->alloc);
106 oidcpy(&table->item[table->nr].given, given);
107 oidcpy(&table->item[table->nr].commit, commit);
108 table->item[table->nr].used = 0;
109 table->nr++;
110}
111
112static int handle_line(char *line, struct merge_parents *merge_parents)
113{
114 int i, len = strlen(line);
115 struct origin_data *origin_data;
116 char *src;
117 const char *origin, *tag_name;
9fa62137 118 char *to_free = NULL;
ce6521e4
DL
119 struct src_data *src_data;
120 struct string_list_item *item;
121 int pulling_head = 0;
122 struct object_id oid;
123 const unsigned hexsz = the_hash_algo->hexsz;
124
125 if (len < hexsz + 3 || line[hexsz] != '\t')
126 return 1;
127
128 if (starts_with(line + hexsz + 1, "not-for-merge"))
129 return 0;
130
131 if (line[hexsz + 1] != '\t')
132 return 2;
133
134 i = get_oid_hex(line, &oid);
135 if (i)
136 return 3;
137
138 if (!find_merge_parent(merge_parents, &oid, NULL))
139 return 0; /* subsumed by other parents */
140
ca56dadb 141 CALLOC_ARRAY(origin_data, 1);
ce6521e4
DL
142 oidcpy(&origin_data->oid, &oid);
143
144 if (line[len - 1] == '\n')
145 line[len - 1] = 0;
146 line += hexsz + 2;
147
148 /*
149 * At this point, line points at the beginning of comment e.g.
150 * "branch 'frotz' of git://that/repository.git".
151 * Find the repository name and point it with src.
152 */
153 src = strstr(line, " of ");
154 if (src) {
155 *src = 0;
156 src += 4;
157 pulling_head = 0;
158 } else {
159 src = line;
160 pulling_head = 1;
161 }
162
163 item = unsorted_string_list_lookup(&srcs, src);
164 if (!item) {
165 item = string_list_append(&srcs, src);
166 item->util = xcalloc(1, sizeof(struct src_data));
167 init_src_data(item->util);
168 }
169 src_data = item->util;
170
171 if (pulling_head) {
172 origin = src;
173 src_data->head_status |= 1;
174 } else if (skip_prefix(line, "branch ", &origin)) {
175 origin_data->is_local_branch = 1;
176 string_list_append(&src_data->branch, origin);
177 src_data->head_status |= 2;
178 } else if (skip_prefix(line, "tag ", &tag_name)) {
179 origin = line;
180 string_list_append(&src_data->tag, tag_name);
181 src_data->head_status |= 2;
182 } else if (skip_prefix(line, "remote-tracking branch ", &origin)) {
183 string_list_append(&src_data->r_branch, origin);
184 src_data->head_status |= 2;
185 } else {
186 origin = src;
187 string_list_append(&src_data->generic, line);
188 src_data->head_status |= 2;
189 }
190
191 if (!strcmp(".", src) || !strcmp(src, origin)) {
192 int len = strlen(origin);
193 if (origin[0] == '\'' && origin[len - 1] == '\'')
9fa62137 194 origin = to_free = xmemdupz(origin + 1, len - 2);
ce6521e4 195 } else
9fa62137 196 origin = to_free = xstrfmt("%s of %s", origin, src);
ce6521e4
DL
197 if (strcmp(".", src))
198 origin_data->is_local_branch = 0;
199 string_list_append(&origins, origin)->util = origin_data;
9fa62137 200 free(to_free);
ce6521e4
DL
201 return 0;
202}
203
204static void print_joined(const char *singular, const char *plural,
205 struct string_list *list, struct strbuf *out)
206{
207 if (list->nr == 0)
208 return;
209 if (list->nr == 1) {
210 strbuf_addf(out, "%s%s", singular, list->items[0].string);
211 } else {
212 int i;
213 strbuf_addstr(out, plural);
214 for (i = 0; i < list->nr - 1; i++)
215 strbuf_addf(out, "%s%s", i > 0 ? ", " : "",
216 list->items[i].string);
217 strbuf_addf(out, " and %s", list->items[list->nr - 1].string);
218 }
219}
220
221static void add_branch_desc(struct strbuf *out, const char *name)
222{
223 struct strbuf desc = STRBUF_INIT;
224
225 if (!read_branch_desc(&desc, name)) {
226 const char *bp = desc.buf;
227 while (*bp) {
228 const char *ep = strchrnul(bp, '\n');
229 if (*ep)
230 ep++;
231 strbuf_addf(out, " : %.*s", (int)(ep - bp), bp);
232 bp = ep;
233 }
234 strbuf_complete_line(out);
235 }
236 strbuf_release(&desc);
237}
238
239#define util_as_integral(elem) ((intptr_t)((elem)->util))
240
241static void record_person_from_buf(int which, struct string_list *people,
242 const char *buffer)
243{
244 char *name_buf, *name, *name_end;
245 struct string_list_item *elem;
246 const char *field;
247
248 field = (which == 'a') ? "\nauthor " : "\ncommitter ";
249 name = strstr(buffer, field);
250 if (!name)
251 return;
252 name += strlen(field);
253 name_end = strchrnul(name, '<');
254 if (*name_end)
255 name_end--;
256 while (isspace(*name_end) && name <= name_end)
257 name_end--;
258 if (name_end < name)
259 return;
260 name_buf = xmemdupz(name, name_end - name + 1);
261
262 elem = string_list_lookup(people, name_buf);
263 if (!elem) {
264 elem = string_list_insert(people, name_buf);
265 elem->util = (void *)0;
266 }
267 elem->util = (void*)(util_as_integral(elem) + 1);
268 free(name_buf);
269}
270
271
272static void record_person(int which, struct string_list *people,
273 struct commit *commit)
274{
ecb5091f
ÆAB
275 const char *buffer = repo_get_commit_buffer(the_repository, commit,
276 NULL);
ce6521e4 277 record_person_from_buf(which, people, buffer);
ecb5091f 278 repo_unuse_commit_buffer(the_repository, commit, buffer);
ce6521e4
DL
279}
280
281static int cmp_string_list_util_as_integral(const void *a_, const void *b_)
282{
283 const struct string_list_item *a = a_, *b = b_;
284 return util_as_integral(b) - util_as_integral(a);
285}
286
287static void add_people_count(struct strbuf *out, struct string_list *people)
288{
289 if (people->nr == 1)
290 strbuf_addstr(out, people->items[0].string);
291 else if (people->nr == 2)
292 strbuf_addf(out, "%s (%d) and %s (%d)",
293 people->items[0].string,
294 (int)util_as_integral(&people->items[0]),
295 people->items[1].string,
296 (int)util_as_integral(&people->items[1]));
297 else if (people->nr)
298 strbuf_addf(out, "%s (%d) and others",
299 people->items[0].string,
300 (int)util_as_integral(&people->items[0]));
301}
302
303static void credit_people(struct strbuf *out,
304 struct string_list *them,
305 int kind)
306{
307 const char *label;
308 const char *me;
309
310 if (kind == 'a') {
311 label = "By";
312 me = git_author_info(IDENT_NO_DATE);
313 } else {
314 label = "Via";
315 me = git_committer_info(IDENT_NO_DATE);
316 }
317
318 if (!them->nr ||
319 (them->nr == 1 &&
320 me &&
321 skip_prefix(me, them->items->string, &me) &&
322 starts_with(me, " <")))
323 return;
f99e1d94 324 strbuf_addf(out, "\n%s %s ", comment_line_str, label);
ce6521e4
DL
325 add_people_count(out, them);
326}
327
328static void add_people_info(struct strbuf *out,
329 struct string_list *authors,
330 struct string_list *committers)
331{
332 QSORT(authors->items, authors->nr,
333 cmp_string_list_util_as_integral);
334 QSORT(committers->items, committers->nr,
335 cmp_string_list_util_as_integral);
336
337 credit_people(out, authors, 'a');
338 credit_people(out, committers, 'c');
339}
340
341static void shortlog(const char *name,
342 struct origin_data *origin_data,
343 struct commit *head,
344 struct rev_info *rev,
345 struct fmt_merge_msg_opts *opts,
346 struct strbuf *out)
347{
348 int i, count = 0;
349 struct commit *commit;
350 struct object *branch;
351 struct string_list subjects = STRING_LIST_INIT_DUP;
352 struct string_list authors = STRING_LIST_INIT_DUP;
353 struct string_list committers = STRING_LIST_INIT_DUP;
354 int flags = UNINTERESTING | TREESAME | SEEN | SHOWN | ADDED;
355 struct strbuf sb = STRBUF_INIT;
356 const struct object_id *oid = &origin_data->oid;
357 int limit = opts->shortlog_len;
358
359 branch = deref_tag(the_repository, parse_object(the_repository, oid),
360 oid_to_hex(oid),
361 the_hash_algo->hexsz);
362 if (!branch || branch->type != OBJ_COMMIT)
363 return;
364
365 setup_revisions(0, NULL, rev, NULL);
366 add_pending_object(rev, branch, name);
367 add_pending_object(rev, &head->object, "^HEAD");
368 head->object.flags |= UNINTERESTING;
369 if (prepare_revision_walk(rev))
370 die("revision walk setup failed");
371 while ((commit = get_revision(rev)) != NULL) {
372 struct pretty_print_context ctx = {0};
373
374 if (commit->parents && commit->parents->next) {
375 /* do not list a merge but count committer */
376 if (opts->credit_people)
377 record_person('c', &committers, commit);
378 continue;
379 }
380 if (!count && opts->credit_people)
381 /* the 'tip' committer */
382 record_person('c', &committers, commit);
383 if (opts->credit_people)
384 record_person('a', &authors, commit);
385 count++;
386 if (subjects.nr > limit)
387 continue;
388
bab82164
ÆAB
389 repo_format_commit_message(the_repository, commit, "%s", &sb,
390 &ctx);
ce6521e4
DL
391 strbuf_ltrim(&sb);
392
393 if (!sb.len)
394 string_list_append(&subjects,
395 oid_to_hex(&commit->object.oid));
396 else
397 string_list_append_nodup(&subjects,
398 strbuf_detach(&sb, NULL));
399 }
400
401 if (opts->credit_people)
402 add_people_info(out, &authors, &committers);
403 if (count > limit)
404 strbuf_addf(out, "\n* %s: (%d commits)\n", name, count);
405 else
406 strbuf_addf(out, "\n* %s:\n", name);
407
408 if (origin_data->is_local_branch && use_branch_desc)
409 add_branch_desc(out, name);
410
411 for (i = 0; i < subjects.nr; i++)
412 if (i >= limit)
413 strbuf_addstr(out, " ...\n");
414 else
415 strbuf_addf(out, " %s\n", subjects.items[i].string);
416
417 clear_commit_marks((struct commit *)branch, flags);
418 clear_commit_marks(head, flags);
419 free_commit_list(rev->commits);
420 rev->commits = NULL;
421 rev->pending.nr = 0;
422
423 string_list_clear(&authors, 0);
424 string_list_clear(&committers, 0);
425 string_list_clear(&subjects, 0);
426}
427
6e6029a8
JH
428/*
429 * See if dest_branch matches with any glob pattern on the
430 * suppress_dest_patterns list.
431 *
432 * We may want to also allow negative matches e.g. ":!glob" like we do
433 * for pathspec, but for now, let's keep it simple and stupid.
434 */
435static int dest_suppressed(const char *dest_branch)
436{
437 struct string_list_item *item;
438
439 for_each_string_list_item(item, &suppress_dest_patterns) {
440 if (!wildmatch(item->string, dest_branch, WM_PATHNAME))
441 return 1;
442 }
443 return 0;
444}
445
ce6521e4
DL
446static void fmt_merge_msg_title(struct strbuf *out,
447 const char *current_branch)
448{
449 int i = 0;
450 char *sep = "";
451
452 strbuf_addstr(out, "Merge ");
453 for (i = 0; i < srcs.nr; i++) {
454 struct src_data *src_data = srcs.items[i].util;
455 const char *subsep = "";
456
457 strbuf_addstr(out, sep);
458 sep = "; ";
459
460 if (src_data->head_status == 1) {
461 strbuf_addstr(out, srcs.items[i].string);
462 continue;
463 }
464 if (src_data->head_status == 3) {
465 subsep = ", ";
466 strbuf_addstr(out, "HEAD");
467 }
468 if (src_data->branch.nr) {
469 strbuf_addstr(out, subsep);
470 subsep = ", ";
471 print_joined("branch ", "branches ", &src_data->branch,
472 out);
473 }
474 if (src_data->r_branch.nr) {
475 strbuf_addstr(out, subsep);
476 subsep = ", ";
477 print_joined("remote-tracking branch ", "remote-tracking branches ",
478 &src_data->r_branch, out);
479 }
480 if (src_data->tag.nr) {
481 strbuf_addstr(out, subsep);
482 subsep = ", ";
483 print_joined("tag ", "tags ", &src_data->tag, out);
484 }
485 if (src_data->generic.nr) {
486 strbuf_addstr(out, subsep);
487 print_joined("commit ", "commits ", &src_data->generic,
488 out);
489 }
490 if (strcmp(".", srcs.items[i].string))
491 strbuf_addf(out, " of %s", srcs.items[i].string);
492 }
493
6e6029a8
JH
494 if (!dest_suppressed(current_branch))
495 strbuf_addf(out, " into %s", current_branch);
496 strbuf_addch(out, '\n');
ce6521e4
DL
497}
498
499static void fmt_tag_signature(struct strbuf *tagbuf,
500 struct strbuf *sig,
501 const char *buf,
502 unsigned long len)
503{
504 const char *tag_body = strstr(buf, "\n\n");
505 if (tag_body) {
506 tag_body += 2;
507 strbuf_add(tagbuf, tag_body, buf + len - tag_body);
508 }
509 strbuf_complete_line(tagbuf);
510 if (sig->len) {
511 strbuf_addch(tagbuf, '\n');
787cb8a4 512 strbuf_add_commented_lines(tagbuf, sig->buf, sig->len,
a1bb146a 513 comment_line_str);
ce6521e4
DL
514 }
515}
516
517static void fmt_merge_msg_sigs(struct strbuf *out)
518{
519 int i, tag_number = 0, first_tag = 0;
520 struct strbuf tagbuf = STRBUF_INIT;
521
522 for (i = 0; i < origins.nr; i++) {
523 struct object_id *oid = origins.items[i].util;
524 enum object_type type;
482c1191 525 unsigned long size;
bc726bd0
ÆAB
526 char *buf = repo_read_object_file(the_repository, oid, &type,
527 &size);
482c1191 528 char *origbuf = buf;
529 unsigned long len = size;
bf04590e 530 struct signature_check sigc = { NULL };
482c1191 531 struct strbuf payload = STRBUF_INIT, sig = STRBUF_INIT;
ce6521e4
DL
532
533 if (!buf || type != OBJ_TAG)
534 goto next;
ce6521e4 535
482c1191 536 if (!parse_signature(buf, size, &payload, &sig))
537 ;/* merely annotated */
538 else {
539 buf = payload.buf;
540 len = payload.len;
122842fd 541 sigc.payload_type = SIGNATURE_PAYLOAD_TAG;
02769437
FS
542 sigc.payload = strbuf_detach(&payload, &sigc.payload_len);
543 if (check_signature(&sigc, sig.buf, sig.len) &&
b5726a5d 544 !sigc.output)
482c1191 545 strbuf_addstr(&sig, "gpg verification failed.\n");
546 else
b5726a5d 547 strbuf_addstr(&sig, sigc.output);
482c1191 548 }
ce6521e4
DL
549
550 if (!tag_number++) {
551 fmt_tag_signature(&tagbuf, &sig, buf, len);
552 first_tag = i;
553 } else {
554 if (tag_number == 2) {
555 struct strbuf tagline = STRBUF_INIT;
556 strbuf_addch(&tagline, '\n');
557 strbuf_add_commented_lines(&tagline,
558 origins.items[first_tag].string,
787cb8a4 559 strlen(origins.items[first_tag].string),
a1bb146a 560 comment_line_str);
ce6521e4
DL
561 strbuf_insert(&tagbuf, 0, tagline.buf,
562 tagline.len);
563 strbuf_release(&tagline);
564 }
565 strbuf_addch(&tagbuf, '\n');
566 strbuf_add_commented_lines(&tagbuf,
567 origins.items[i].string,
787cb8a4 568 strlen(origins.items[i].string),
a1bb146a 569 comment_line_str);
ce6521e4
DL
570 fmt_tag_signature(&tagbuf, &sig, buf, len);
571 }
482c1191 572 strbuf_release(&payload);
ce6521e4 573 strbuf_release(&sig);
c39fc06b 574 signature_check_clear(&sigc);
ce6521e4 575 next:
482c1191 576 free(origbuf);
ce6521e4
DL
577 }
578 if (tagbuf.len) {
579 strbuf_addch(out, '\n');
580 strbuf_addbuf(out, &tagbuf);
581 }
582 strbuf_release(&tagbuf);
583}
584
585static void find_merge_parents(struct merge_parents *result,
586 struct strbuf *in, struct object_id *head)
587{
588 struct commit_list *parents;
589 struct commit *head_commit;
590 int pos = 0, i, j;
591
592 parents = NULL;
593 while (pos < in->len) {
594 int len;
595 char *p = in->buf + pos;
596 char *newline = strchr(p, '\n');
597 const char *q;
598 struct object_id oid;
599 struct commit *parent;
600 struct object *obj;
601
602 len = newline ? newline - p : strlen(p);
603 pos += len + !!newline;
604
605 if (parse_oid_hex(p, &oid, &q) ||
606 q[0] != '\t' ||
607 q[1] != '\t')
608 continue; /* skip not-for-merge */
609 /*
610 * Do not use get_merge_parent() here; we do not have
611 * "name" here and we do not want to contaminate its
612 * util field yet.
613 */
614 obj = parse_object(the_repository, &oid);
d850b7a5
ÆAB
615 parent = (struct commit *)repo_peel_to_type(the_repository,
616 NULL, 0, obj,
617 OBJ_COMMIT);
ce6521e4
DL
618 if (!parent)
619 continue;
620 commit_list_insert(parent, &parents);
621 add_merge_parent(result, &obj->oid, &parent->object.oid);
622 }
623 head_commit = lookup_commit(the_repository, head);
624 if (head_commit)
625 commit_list_insert(head_commit, &parents);
626 reduce_heads_replace(&parents);
627
628 while (parents) {
629 struct commit *cmit = pop_commit(&parents);
630 for (i = 0; i < result->nr; i++)
631 if (oideq(&result->item[i].commit, &cmit->object.oid))
632 result->item[i].used = 1;
633 }
634
635 for (i = j = 0; i < result->nr; i++) {
636 if (result->item[i].used) {
637 if (i != j)
638 result->item[j] = result->item[i];
639 j++;
640 }
641 }
642 result->nr = j;
643}
644
645
646int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
647 struct fmt_merge_msg_opts *opts)
648{
649 int i = 0, pos = 0;
650 struct object_id head_oid;
651 const char *current_branch;
652 void *current_branch_to_free;
653 struct merge_parents merge_parents;
654
2217230d
JS
655 if (!suppress_dest_pattern_seen) {
656 string_list_append(&suppress_dest_patterns, "main");
6e6029a8 657 string_list_append(&suppress_dest_patterns, "master");
2217230d 658 }
6e6029a8 659
ce6521e4
DL
660 memset(&merge_parents, 0, sizeof(merge_parents));
661
bd2bc942 662 /* learn the commit that we merge into and the current branch name */
ce6521e4
DL
663 current_branch = current_branch_to_free =
664 resolve_refdup("HEAD", RESOLVE_REF_READING, &head_oid, NULL);
665 if (!current_branch)
666 die("No current branch");
bd2bc942
JH
667
668 if (opts->into_name)
669 current_branch = opts->into_name;
670 else if (starts_with(current_branch, "refs/heads/"))
ce6521e4
DL
671 current_branch += 11;
672
673 find_merge_parents(&merge_parents, in, &head_oid);
674
675 /* get a line */
676 while (pos < in->len) {
677 int len;
678 char *newline, *p = in->buf + pos;
679
680 newline = strchr(p, '\n');
681 len = newline ? newline - p : strlen(p);
682 pos += len + !!newline;
683 i++;
684 p[len] = 0;
685 if (handle_line(p, &merge_parents))
686 die("error in line %d: %.*s", i, len, p);
687 }
688
689 if (opts->add_title && srcs.nr)
690 fmt_merge_msg_title(out, current_branch);
691
692 if (origins.nr)
693 fmt_merge_msg_sigs(out);
694
695 if (opts->shortlog_len) {
696 struct commit *head;
697 struct rev_info rev;
698
699 head = lookup_commit_or_die(&head_oid, "HEAD");
700 repo_init_revisions(the_repository, &rev, NULL);
701 rev.commit_format = CMIT_FMT_ONELINE;
09322b1d 702 diff_merges_suppress(&rev);
ce6521e4
DL
703 rev.limited = 1;
704
705 strbuf_complete_line(out);
706
707 for (i = 0; i < origins.nr; i++)
708 shortlog(origins.items[i].string,
709 origins.items[i].util,
710 head, &rev, opts, out);
2108fe4a 711 release_revisions(&rev);
ce6521e4
DL
712 }
713
714 strbuf_complete_line(out);
715 free(current_branch_to_free);
716 free(merge_parents.item);
717 return 0;
718}