commit.c: remove print_commit_list()
authorJunio C Hamano <gitster@pobox.com>
Fri, 8 Jul 2016 17:09:28 +0000 (10:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 8 Jul 2016 17:11:36 +0000 (10:11 -0700)
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>
bisect.c
commit.c
commit.h
index dc13319c20b255d2a3d76f237746ba5dc953680a..02f76f0f5df9e3156be037578c79ab2acc15592f 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -646,7 +646,10 @@ static void exit_if_skipped_commits(struct commit_list *tried,
 
        printf("There are only 'skip'ped commits left to test.\n"
               "The first %s commit could be any of:\n", term_bad);
-       print_commit_list(tried, "%s\n", "%s\n");
+
+       for ( ; tried; tried = tried->next)
+               printf("%s\n", oid_to_hex(&tried->item->object.oid));
+
        if (bad)
                printf("%s\n", oid_to_hex(bad));
        printf("We cannot bisect more!\n");
index 3f4f371e5eec41fa67345c0b9d373b541e52172a..bf279725339fe9778042d596d09ad984ad9be2d0 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1617,16 +1617,6 @@ struct commit_list **commit_list_append(struct commit *commit,
        return &new->next;
 }
 
-void print_commit_list(struct commit_list *list,
-                      const char *format_cur,
-                      const char *format_last)
-{
-       for ( ; list; list = list->next) {
-               const char *format = list->next ? format_cur : format_last;
-               printf(format, oid_to_hex(&list->item->object.oid));
-       }
-}
-
 const char *find_commit_header(const char *msg, const char *key, size_t *out_len)
 {
        int key_len = strlen(key);
index 78ed513c75401b0d1fa821dc18baad833201b4e6..71693ce0fd9613320114586a3c23d309e8427368 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -376,10 +376,6 @@ extern int parse_signed_commit(const struct commit *commit,
                               struct strbuf *message, struct strbuf *signature);
 extern int remove_signature(struct strbuf *buf);
 
-extern void print_commit_list(struct commit_list *list,
-                             const char *format_cur,
-                             const char *format_last);
-
 /*
  * Check the signature of the given commit. The result of the check is stored
  * in sig->check_result, 'G' for a good signature, 'U' for a good signature