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