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 / refs / packed-backend.h

48 lines · 1615 bytes Raw Blame History
1#ifndef REFS_PACKED_BACKEND_H
2#define REFS_PACKED_BACKEND_H
3
4struct repository;
5struct ref_transaction;
6struct ref_store_init_options;
7
8/*
9 * Support for storing references in a `packed-refs` file.
10 *
11 * Note that this backend doesn't check for D/F conflicts, because it
12 * doesn't care about them. But usually it should be wrapped in a
13 * `files_ref_store` that prevents D/F conflicts from being created,
14 * even among packed refs.
15 */
16
17struct ref_store *packed_ref_store_init(struct repository *repo,
18 const char *payload,
19 const char *gitdir,
20 const struct ref_store_init_options *options);
21
22/*
23 * Lock the packed-refs file for writing. Flags is passed to
24 * repo_hold_lock_file_for_update(). Return 0 on success. On errors, write
25 * an error message to `err` and return a nonzero value.
26 */
27int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err);
28
29void packed_refs_unlock(struct ref_store *ref_store);
30int packed_refs_is_locked(struct ref_store *ref_store);
31
32/*
33 * Obtain the size of the `packed-refs` file. Reports `0` as size in case there
34 * is no packed-refs file. Returns 0 on success, negative otherwise.
35 */
36int packed_refs_size(struct ref_store *ref_store,
37 size_t *out);
38
39/*
40 * Return true if `transaction` really needs to be carried out against
41 * the specified packed_ref_store, or false if it can be skipped
42 * (i.e., because it is an obvious NOOP). `ref_store` must be locked
43 * before calling this function.
44 */
45int is_packed_transaction_needed(struct ref_store *ref_store,
46 struct ref_transaction *transaction);
47
48#endif /* REFS_PACKED_BACKEND_H */