]> git.ipfire.org Git - thirdparty/git.git/blob - shallow.h
shallow: extract a header file for shallow-related functions
[thirdparty/git.git] / shallow.h
1 #ifndef SHALLOW_H
2 #define SHALLOW_H
3
4 #include "lockfile.h"
5 #include "object.h"
6 #include "repository.h"
7 #include "strbuf.h"
8
9 void set_alternate_shallow_file(struct repository *r, const char *path, int override);
10 int register_shallow(struct repository *r, const struct object_id *oid);
11 int unregister_shallow(const struct object_id *oid);
12 int is_repository_shallow(struct repository *r);
13 int commit_shallow_file(struct repository *r, struct lock_file *lk);
14 void rollback_shallow_file(struct repository *r, struct lock_file *lk);
15
16 struct commit_list *get_shallow_commits(struct object_array *heads,
17 int depth, int shallow_flag, int not_shallow_flag);
18 struct commit_list *get_shallow_commits_by_rev_list(
19 int ac, const char **av, int shallow_flag, int not_shallow_flag);
20 int write_shallow_commits(struct strbuf *out, int use_pack_protocol,
21 const struct oid_array *extra);
22
23 void setup_alternate_shallow(struct lock_file *shallow_lock,
24 const char **alternate_shallow_file,
25 const struct oid_array *extra);
26
27 const char *setup_temporary_shallow(const struct oid_array *extra);
28
29 void advertise_shallow_grafts(int);
30
31 #define PRUNE_SHOW_ONLY 1
32 #define PRUNE_QUICK 2
33 void prune_shallow(unsigned options);
34
35 /*
36 * Initialize with prepare_shallow_info() or zero-initialize (equivalent to
37 * prepare_shallow_info with a NULL oid_array).
38 */
39 struct shallow_info {
40 struct oid_array *shallow;
41 int *ours, nr_ours;
42 int *theirs, nr_theirs;
43 struct oid_array *ref;
44
45 /* for receive-pack */
46 uint32_t **used_shallow;
47 int *need_reachability_test;
48 int *reachable;
49 int *shallow_ref;
50 struct commit **commits;
51 int nr_commits;
52 };
53
54 void prepare_shallow_info(struct shallow_info *, struct oid_array *);
55 void clear_shallow_info(struct shallow_info *);
56 void remove_nonexistent_theirs_shallow(struct shallow_info *);
57 void assign_shallow_commits_to_refs(struct shallow_info *info,
58 uint32_t **used,
59 int *ref_status);
60 int delayed_reachability_test(struct shallow_info *si, int c);
61
62 extern struct trace_key trace_shallow;
63
64 #endif /* SHALLOW_H */