1 /*
2  * Copyright (C) the libgit2 contributors. All rights reserved.
3  *
4  * This file is part of libgit2, distributed under the GNU GPL v2 with
5  * a Linking Exception. For full terms see the included COPYING file.
6  */
7 #ifndef INCLUDE_revwalk_h__
8 #define INCLUDE_revwalk_h__
9 
10 #include "common.h"
11 
12 #include "git2/revwalk.h"
13 #include "oidmap.h"
14 #include "commit_list.h"
15 #include "pqueue.h"
16 #include "pool.h"
17 #include "vector.h"
18 
19 #include "oidmap.h"
20 
21 struct git_revwalk {
22 	git_repository *repo;
23 	git_odb *odb;
24 
25 	git_oidmap *commits;
26 	git_pool commit_pool;
27 
28 	git_commit_list *iterator_topo;
29 	git_commit_list *iterator_rand;
30 	git_commit_list *iterator_reverse;
31 	git_pqueue iterator_time;
32 
33 	int (*get_next)(git_commit_list_node **, git_revwalk *);
34 	int (*enqueue)(git_revwalk *, git_commit_list_node *);
35 
36 	unsigned walking:1,
37 		first_parent: 1,
38 		did_hide: 1,
39 		did_push: 1,
40 		limited: 1;
41 	unsigned int sorting;
42 
43 	/* the pushes and hides */
44 	git_commit_list *user_input;
45 
46 	/* hide callback */
47 	git_revwalk_hide_cb hide_cb;
48 	void *hide_cb_payload;
49 };
50 
51 git_commit_list_node *git_revwalk__commit_lookup(git_revwalk *walk, const git_oid *oid);
52 
53 typedef struct {
54 	int uninteresting;
55 	int from_glob;
56 	int insert_by_date;
57 } git_revwalk__push_options;
58 
59 #define GIT_REVWALK__PUSH_OPTIONS_INIT { 0 }
60 
61 int git_revwalk__push_commit(git_revwalk *walk,
62 	const git_oid *oid,
63 	const git_revwalk__push_options *opts);
64 
65 int git_revwalk__push_ref(git_revwalk *walk,
66 	const char *refname,
67 	const git_revwalk__push_options *opts);
68 
69 int git_revwalk__push_glob(git_revwalk *walk,
70 	const char *glob,
71 	const git_revwalk__push_options *given_opts);
72 
73 #endif
74