am, rebase: fix arghelp syntax of --empty
[git.git] / shallow.h
blobe9ca7e4bc80451a74dc10fb6d4e1a0b190dc4dcc
1 #ifndef SHALLOW_H
2 #define SHALLOW_H
4 #include "lockfile.h"
5 #include "object.h"
6 #include "repository.h"
7 #include "strbuf.h"
9 struct oid_array;
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);
17 * Lock for updating the $GIT_DIR/shallow file.
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.
25 struct shallow_lock {
26 struct lock_file lock;
28 #define SHALLOW_LOCK_INIT { \
29 .lock = LOCK_INIT, \
32 /* commit $GIT_DIR/shallow and reset stat-validity checks */
33 int commit_shallow_file(struct repository *r, struct shallow_lock *lk);
34 /* rollback $GIT_DIR/shallow and reset stat-validity checks */
35 void rollback_shallow_file(struct repository *r, struct shallow_lock *lk);
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);
44 void setup_alternate_shallow(struct shallow_lock *shallow_lock,
45 const char **alternate_shallow_file,
46 const struct oid_array *extra);
48 const char *setup_temporary_shallow(const struct oid_array *extra);
50 void advertise_shallow_grafts(int);
52 #define PRUNE_SHOW_ONLY 1
53 #define PRUNE_QUICK 2
54 void prune_shallow(unsigned options);
57 * Initialize with prepare_shallow_info() or zero-initialize (equivalent to
58 * prepare_shallow_info with a NULL oid_array).
60 struct shallow_info {
61 struct oid_array *shallow;
62 int *ours, nr_ours;
63 int *theirs, nr_theirs;
64 struct oid_array *ref;
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;
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);
83 extern struct trace_key trace_shallow;
85 #endif /* SHALLOW_H */