Move print_commit_list to libgit.a
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 26 Oct 2012 15:53:51 +0000 (22:53 +0700)
committerJeff King <peff@peff.net>
Mon, 29 Oct 2012 07:08:30 +0000 (03:08 -0400)
This is used by bisect.c, part of libgit.a while it stays in
builtin/rev-list.c. Move it to commit.c so that we won't get undefined
reference if a program that uses libgit.a happens to pull it in.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
bisect.h
builtin/rev-list.c
commit.c
commit.h
index ec3c3ff007a53105089b9699d5917bccc28c7cfe..2a6c831f3ecdd12839dff9a9740881fc836b09bd 100644 (file)
--- a/bisect.h
+++ b/bisect.h
@@ -11,10 +11,6 @@ extern struct commit_list *filter_skipped(struct commit_list *list,
                                          int *count,
                                          int *skipped_first);
 
-extern void print_commit_list(struct commit_list *list,
-                             const char *format_cur,
-                             const char *format_last);
-
 #define BISECT_SHOW_ALL                (1<<0)
 #define REV_LIST_QUIET         (1<<1)
 
index a0ec84e44bcefe274cc3f33b5e2115b8352b5c37..67701be55193db0fd9733ee7c4962db08072045c 100644 (file)
@@ -201,16 +201,6 @@ static void show_edge(struct commit *commit)
        printf("-%s\n", sha1_to_hex(commit->object.sha1));
 }
 
-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, sha1_to_hex(list->item->object.sha1));
-       }
-}
-
 static void print_var_str(const char *var, const char *val)
 {
        printf("%s='%s'\n", var, val);
index 213bc98c183b820c43c66d67a15133b4a401f6a4..e8eb0aec5509a4fd09698bd15a37d1f4e8341f5e 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -1347,3 +1347,13 @@ struct commit_list **commit_list_append(struct commit *commit,
        new->next = NULL;
        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, sha1_to_hex(list->item->object.sha1));
+       }
+}
index 9f2131318d4c43fdaaca40e45e45e7d1af61cdfe..c4cd046160c7594c09bf0dd146e7cd862cb3fc0f 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -222,4 +222,8 @@ struct commit *get_merge_parent(const char *name);
 
 extern int parse_signed_commit(const unsigned char *sha1,
                               struct strbuf *message, struct strbuf *signature);
+extern void print_commit_list(struct commit_list *list,
+                             const char *format_cur,
+                             const char *format_last);
+
 #endif /* COMMIT_H */