interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / shallow.h

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