@matheusbsbs / matheus-bagliano / commits / 653194758e
Fork 0

Move commit_list_count() to commit.c

This function is useful outside builtin-merge-recursive, for example in builtin-merge. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Miklos Vajna committed Jun 27, 2008 at 18:21 UTC 653194758ee338b7c87d011007c532ed5cf68d45
3 files changed +9 -8
builtin-merge-recursive.c
-8
@@ -42,14 +42,6 @@ static struct tree *shift_tree_object(struct tree *one, struct tree *two)
42 * - *(int *)commit->object.sha1 set to the virtual id.
43 */
44
45 -static unsigned commit_list_count(const struct commit_list *l)
46 -{
47 - unsigned c = 0;
48 - for (; l; l = l->next )
49 - c++;
50 - return c;
51 -}
52 -
45 static struct commit *make_virtual_commit(struct tree *tree, const char *comment)
46 {
47 struct commit *commit = xcalloc(1, sizeof(struct commit));
commit.c
+8
@@ -325,6 +325,14 @@ struct commit_list *commit_list_insert(struct commit *item, struct commit_list *
325 return new_list;
326 }
327
328 +unsigned commit_list_count(const struct commit_list *l)
329 +{
330 + unsigned c = 0;
331 + for (; l; l = l->next )
332 + c++;
333 + return c;
334 +}
335 +
336 void free_commit_list(struct commit_list *list)
337 {
338 while (list) {
commit.h
+1
@@ -41,6 +41,7 @@ int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
41 int parse_commit(struct commit *item);
42
43 struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p);
44 +unsigned commit_list_count(const struct commit_list *l);
45 struct commit_list * insert_by_date(struct commit *item, struct commit_list **list);
46
47 void free_commit_list(struct commit_list *list);