]> git.ipfire.org Git - thirdparty/git.git/blame - refs/packed-backend.h
Merge branch 'en/fetch-negotiation-default-fix'
[thirdparty/git.git] / refs / packed-backend.h
CommitLineData
67be7c5a
MH
1#ifndef REFS_PACKED_BACKEND_H
2#define REFS_PACKED_BACKEND_H
3
34224e14 4struct repository;
611023f8
RJ
5struct ref_transaction;
6
2775d872
MH
7/*
8 * Support for storing references in a `packed-refs` file.
9 *
10 * Note that this backend doesn't check for D/F conflicts, because it
11 * doesn't care about them. But usually it should be wrapped in a
12 * `files_ref_store` that prevents D/F conflicts from being created,
13 * even among packed refs.
14 */
15
34224e14 16struct ref_store *packed_ref_store_create(struct repository *repo,
99f0d97b 17 const char *gitdir,
e0cc8ac8 18 unsigned int store_flags);
67be7c5a
MH
19
20/*
21 * Lock the packed-refs file for writing. Flags is passed to
c8bed835
MH
22 * hold_lock_file_for_update(). Return 0 on success. On errors, write
23 * an error message to `err` and return a nonzero value.
67be7c5a 24 */
c8bed835 25int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err);
67be7c5a 26
49aebcf4
MH
27void packed_refs_unlock(struct ref_store *ref_store);
28int packed_refs_is_locked(struct ref_store *ref_store);
29
7c6bd25c
MH
30/*
31 * Return true if `transaction` really needs to be carried out against
32 * the specified packed_ref_store, or false if it can be skipped
33 * (i.e., because it is an obvious NOOP). `ref_store` must be locked
34 * before calling this function.
35 */
36int is_packed_transaction_needed(struct ref_store *ref_store,
37 struct ref_transaction *transaction);
38
67be7c5a 39#endif /* REFS_PACKED_BACKEND_H */