Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/shallow.h # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers 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 10 struct oid_array; 11 struct strvec; 12 13 void set_alternate_shallow_file(struct repository *r, const char *path); 14 int register_shallow(struct repository *r, const struct object_id *oid); 15 int unregister_shallow(const struct object_id *oid); 16 int 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 */ 27 struct 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 */ 35 int commit_shallow_file(struct repository *r, struct shallow_lock *lk); 36 /* rollback $GIT_DIR/shallow and reset stat-validity checks */ 37 void rollback_shallow_file(struct repository *r, struct shallow_lock *lk); 38 39 int get_shallows_depth(struct object_array *heads, struct object_array *shallows); 40 struct 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); 43 struct commit_list *get_shallow_commits_by_rev_list(struct strvec *argv, 44 int shallow_flag, int not_shallow_flag); 45 int write_shallow_commits(struct strbuf *out, int use_pack_protocol, 46 const struct oid_array *extra); 47 48 void setup_alternate_shallow(struct shallow_lock *shallow_lock, 49 const char **alternate_shallow_file, 50 const struct oid_array *extra); 51 52 const char *setup_temporary_shallow(const struct oid_array *extra); 53 54 void advertise_shallow_grafts(int); 55 56 #define PRUNE_SHOW_ONLY 1 57 #define PRUNE_QUICK 2 58 void 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 */ 64 struct 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 78 void prepare_shallow_info(struct shallow_info *, struct oid_array *); 79 void clear_shallow_info(struct shallow_info *); 80 void remove_nonexistent_theirs_shallow(struct shallow_info *); 81 void assign_shallow_commits_to_refs(struct shallow_info *info, 82 uint32_t **used, 83 int *ref_status); 84 int delayed_reachability_test(struct shallow_info *si, int c); 85 86 extern struct trace_key trace_shallow; 87 88 #endif /* SHALLOW_H */