Skip to content

Commit

Permalink
Move print_commit_list to libgit.a
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jeff King <[email protected]>
  • Loading branch information
pclouds authored and peff committed Oct 29, 2012
1 parent c43cb38 commit efc7df4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 0 additions & 4 deletions bisect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 0 additions & 10 deletions builtin/rev-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
4 changes: 4 additions & 0 deletions commit.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit efc7df4

Please sign in to comment.