commit.c: remove print_commit_list()

The helper function tries to offer a way to conveniently show the last one differently from others, presumably to allow you to say something like A, B, and C. while iterating over a list that has these three elements. However, there is only one caller, and it passes the same format string "%s\n" for both the last one and the other ones. Retire the helper function and update the caller with a simplified version. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Jul 8, 2016 at 10:09 UTC 54307ea7c3ced760ee375483a786ec7180798aed
3 files changed +4 -15
bisect.c
+4 -1
@@ -646,7 +646,10 @@ static void exit_if_skipped_commits(struct commit_list *tried,
646
647 printf("There are only 'skip'ped commits left to test.\n"
648 "The first %s commit could be any of:\n", term_bad);
649 - print_commit_list(tried, "%s\n", "%s\n");
649 +
650 + for ( ; tried; tried = tried->next)
651 + printf("%s\n", oid_to_hex(&tried->item->object.oid));
652 +
653 if (bad)
654 printf("%s\n", oid_to_hex(bad));
655 printf("We cannot bisect more!\n");
commit.c
-10
@@ -1617,16 +1617,6 @@ struct commit_list **commit_list_append(struct commit *commit,
1617 return &new->next;
1618 }
1619
1620 -void print_commit_list(struct commit_list *list,
1621 - const char *format_cur,
1622 - const char *format_last)
1623 -{
1624 - for ( ; list; list = list->next) {
1625 - const char *format = list->next ? format_cur : format_last;
1626 - printf(format, oid_to_hex(&list->item->object.oid));
1627 - }
1628 -}
1629 -
1620 const char *find_commit_header(const char *msg, const char *key, size_t *out_len)
1621 {
1622 int key_len = strlen(key);
commit.h
-4
@@ -376,10 +376,6 @@ extern int parse_signed_commit(const struct commit *commit,
376 struct strbuf *message, struct strbuf *signature);
377 extern int remove_signature(struct strbuf *buf);
378
379 -extern void print_commit_list(struct commit_list *list,
380 - const char *format_cur,
381 - const char *format_last);
382 -
379 /*
380 * Check the signature of the given commit. The result of the check is stored
381 * in sig->check_result, 'G' for a good signature, 'U' for a good signature