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