git
[Ported from github.com/git/git] Sync with Git 2.56.1
Brought by drakestapleton
git / rerere.h
| 1 | #ifndef RERERE_H |
| 2 | #define RERERE_H |
| 3 | |
| 4 | #include "gettext.h" |
| 5 | #include "lockfile.h" |
| 6 | #include "string-list.h" |
| 7 | #include "strmap.h" |
| 8 | |
| 9 | struct pathspec; |
| 10 | struct repository; |
| 11 | |
| 12 | #define RERERE_AUTOUPDATE 01 |
| 13 | #define RERERE_NOAUTOUPDATE 02 |
| 14 | #define RERERE_READONLY 04 |
| 15 | /* If MERGE_RR.lock is taken, return -1 as if rerere were disabled */ |
| 16 | #define RERERE_NOWAIT 010 |
| 17 | |
| 18 | /* |
| 19 | * Marks paths that have been hand-resolved and added to the |
| 20 | * index. Set in the util field of such paths after calling |
| 21 | * rerere_remaining. |
| 22 | */ |
| 23 | extern void *RERERE_RESOLVED; |
| 24 | |
| 25 | struct rerere_cache { |
| 26 | struct repository *repo; |
| 27 | |
| 28 | /* Automatically update cleanly resolved paths to the index. */ |
| 29 | int autoupdate; |
| 30 | |
| 31 | struct strmap dirs; |
| 32 | |
| 33 | struct lock_file write_lock; |
| 34 | }; |
| 35 | |
| 36 | struct rerere_dir; |
| 37 | struct rerere_id { |
| 38 | struct rerere_dir *collection; |
| 39 | int variant; |
| 40 | }; |
| 41 | |
| 42 | int rerere_cache_setup(struct rerere_cache *cache, |
| 43 | struct repository *r, |
| 44 | struct string_list *merge_rr, |
| 45 | int flags); |
| 46 | void rerere_cache_release(struct rerere_cache *cache); |
| 47 | |
| 48 | int repo_rerere(struct repository *, int); |
| 49 | /* |
| 50 | * Given the conflict ID and the name of a "file" used for replaying |
| 51 | * the recorded resolution (e.g. "preimage", "postimage"), return the |
| 52 | * path to that filesystem entity. With "file" specified with NULL, |
| 53 | * return the path to the directory that houses these files. |
| 54 | */ |
| 55 | const char *rerere_path(struct repository *, |
| 56 | struct strbuf *buf, const struct rerere_id *, |
| 57 | const char *file); |
| 58 | int rerere_forget(struct repository *, struct pathspec *); |
| 59 | int rerere_remaining(struct repository *, struct string_list *); |
| 60 | void rerere_clear(struct repository *, struct string_list *); |
| 61 | void rerere_gc(struct repository *, struct string_list *, int); |
| 62 | |
| 63 | /* |
| 64 | * Check whether garbage collection for rerere entries is needed, which is |
| 65 | * the case when there's at least `limit` stale entries that would be pruned. |
| 66 | */ |
| 67 | bool rerere_gc_needed(struct repository *r, size_t limit); |
| 68 | |
| 69 | #define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, "rerere-autoupdate", (v), \ |
| 70 | N_("update the index with reused conflict resolution if possible")) |
| 71 | |
| 72 | #endif |