Move print_commit_list to libgit.a

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>

Nguyễn Thái Ngọc Duy committed Oct 26, 2012 at 22:53 UTC efc7df454e9ec8b730fb2293c8549cec43de6bfa
4 files changed +14 -14
bisect.h
-4
@@ -11,10 +11,6 @@ extern struct commit_list *filter_skipped(struct commit_list *list,
11 int *count,
12 int *skipped_first);
13
14 -extern void print_commit_list(struct commit_list *list,
15 - const char *format_cur,
16 - const char *format_last);
17 -
14 #define BISECT_SHOW_ALL (1<<0)
15 #define REV_LIST_QUIET (1<<1)
16
builtin/rev-list.c
-10
@@ -201,16 +201,6 @@ static void show_edge(struct commit *commit)
201 printf("-%s\n", sha1_to_hex(commit->object.sha1));
202 }
203
204 -void print_commit_list(struct commit_list *list,
205 - const char *format_cur,
206 - const char *format_last)
207 -{
208 - for ( ; list; list = list->next) {
209 - const char *format = list->next ? format_cur : format_last;
210 - printf(format, sha1_to_hex(list->item->object.sha1));
211 - }
212 -}
213 -
204 static void print_var_str(const char *var, const char *val)
205 {
206 printf("%s='%s'\n", var, val);
commit.c
+10
@@ -1347,3 +1347,13 @@ struct commit_list **commit_list_append(struct commit *commit,
1347 new->next = NULL;
1348 return &new->next;
1349 }
1350 +
1351 +void print_commit_list(struct commit_list *list,
1352 + const char *format_cur,
1353 + const char *format_last)
1354 +{
1355 + for ( ; list; list = list->next) {
1356 + const char *format = list->next ? format_cur : format_last;
1357 + printf(format, sha1_to_hex(list->item->object.sha1));
1358 + }
1359 +}
commit.h
+4
@@ -222,4 +222,8 @@ struct commit *get_merge_parent(const char *name);
222
223 extern int parse_signed_commit(const unsigned char *sha1,
224 struct strbuf *message, struct strbuf *signature);
225 +extern void print_commit_list(struct commit_list *list,
226 + const char *format_cur,
227 + const char *format_last);
228 +
229 #endif /* COMMIT_H */