]>
Commit | Line | Data |
---|---|---|
120ad2b0 TB |
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 | ||
a64215b6 EN |
9 | struct oid_array; |
10 | ||
120ad2b0 TB |
11 | void set_alternate_shallow_file(struct repository *r, const char *path, int override); |
12 | int register_shallow(struct repository *r, const struct object_id *oid); | |
13 | int unregister_shallow(const struct object_id *oid); | |
14 | int is_repository_shallow(struct repository *r); | |
cac4b8e2 TB |
15 | |
16 | /* | |
17 | * Lock for updating the $GIT_DIR/shallow file. | |
18 | * | |
19 | * Use `commit_shallow_file()` to commit an update, or | |
20 | * `rollback_shallow_file()` to roll it back. In either case, any | |
21 | * in-memory cached information about which commits are shallow will be | |
22 | * appropriately invalidated so that future operations reflect the new | |
23 | * state. | |
24 | */ | |
25 | struct shallow_lock { | |
26 | struct lock_file lock; | |
27 | }; | |
f69a6e4f ÆAB |
28 | #define SHALLOW_LOCK_INIT { \ |
29 | .lock = LOCK_INIT, \ | |
30 | } | |
cac4b8e2 | 31 | |
a4101617 | 32 | /* commit $GIT_DIR/shallow and reset stat-validity checks */ |
cac4b8e2 | 33 | int commit_shallow_file(struct repository *r, struct shallow_lock *lk); |
a4101617 | 34 | /* rollback $GIT_DIR/shallow and reset stat-validity checks */ |
cac4b8e2 | 35 | void rollback_shallow_file(struct repository *r, struct shallow_lock *lk); |
120ad2b0 TB |
36 | |
37 | struct commit_list *get_shallow_commits(struct object_array *heads, | |
38 | int depth, int shallow_flag, int not_shallow_flag); | |
39 | struct commit_list *get_shallow_commits_by_rev_list( | |
40 | int ac, const char **av, int shallow_flag, int not_shallow_flag); | |
41 | int write_shallow_commits(struct strbuf *out, int use_pack_protocol, | |
42 | const struct oid_array *extra); | |
43 | ||
cac4b8e2 | 44 | void setup_alternate_shallow(struct shallow_lock *shallow_lock, |
120ad2b0 TB |
45 | const char **alternate_shallow_file, |
46 | const struct oid_array *extra); | |
47 | ||
48 | const char *setup_temporary_shallow(const struct oid_array *extra); | |
49 | ||
50 | void advertise_shallow_grafts(int); | |
51 | ||
52 | #define PRUNE_SHOW_ONLY 1 | |
53 | #define PRUNE_QUICK 2 | |
54 | void prune_shallow(unsigned options); | |
55 | ||
56 | /* | |
57 | * Initialize with prepare_shallow_info() or zero-initialize (equivalent to | |
58 | * prepare_shallow_info with a NULL oid_array). | |
59 | */ | |
60 | struct shallow_info { | |
61 | struct oid_array *shallow; | |
62 | int *ours, nr_ours; | |
63 | int *theirs, nr_theirs; | |
64 | struct oid_array *ref; | |
65 | ||
66 | /* for receive-pack */ | |
67 | uint32_t **used_shallow; | |
68 | int *need_reachability_test; | |
69 | int *reachable; | |
70 | int *shallow_ref; | |
71 | struct commit **commits; | |
72 | int nr_commits; | |
73 | }; | |
74 | ||
75 | void prepare_shallow_info(struct shallow_info *, struct oid_array *); | |
76 | void clear_shallow_info(struct shallow_info *); | |
77 | void remove_nonexistent_theirs_shallow(struct shallow_info *); | |
78 | void assign_shallow_commits_to_refs(struct shallow_info *info, | |
79 | uint32_t **used, | |
80 | int *ref_status); | |
81 | int delayed_reachability_test(struct shallow_info *si, int c); | |
82 | ||
83 | extern struct trace_key trace_shallow; | |
84 | ||
85 | #endif /* SHALLOW_H */ |