blob: c32d79c3bd81f1ff6e9247b77a050784b917ecfd [file] [log] [blame]
Stephan Beyer5b2fd952008-07-09 14:58:57 +02001#ifndef RERERE_H
2#define RERERE_H
3
Johannes Schindelinc455c872008-07-21 19:03:49 +01004#include "string-list.h"
Stephan Beyer5b2fd952008-07-09 14:58:57 +02005
Nguyễn Thái Ngọc Duy01a10b02013-07-14 15:35:40 +07006struct pathspec;
Nguyễn Thái Ngọc Duy35843b12018-09-21 17:57:32 +02007struct repository;
Nguyễn Thái Ngọc Duy01a10b02013-07-14 15:35:40 +07008
Junio C Hamanocb6020b2009-12-04 00:20:48 -08009#define RERERE_AUTOUPDATE 01
10#define RERERE_NOAUTOUPDATE 02
Jeff King9dd330e2015-09-01 18:14:09 -040011#define RERERE_READONLY 04
Junio C Hamanocb6020b2009-12-04 00:20:48 -080012
Martin von Zweigbergkac49f5c2011-02-16 05:47:44 -050013/*
14 * Marks paths that have been hand-resolved and added to the
15 * index. Set in the util field of such paths after calling
16 * rerere_remaining.
17 */
18extern void *RERERE_RESOLVED;
19
Junio C Hamano1869bbe2015-07-16 14:50:05 -070020struct rerere_dir;
Junio C Hamano1d51ece2015-07-04 17:38:34 -070021struct rerere_id {
Junio C Hamano1869bbe2015-07-16 14:50:05 -070022 struct rerere_dir *collection;
Junio C Hamanoa13d1372015-07-23 14:23:24 -070023 int variant;
Junio C Hamano1d51ece2015-07-04 17:38:34 -070024};
25
Nguyễn Thái Ngọc Duy55e6b352018-11-10 06:49:09 +010026int setup_rerere(struct repository *,struct string_list *, int);
Nguyễn Thái Ngọc Duy35843b12018-09-21 17:57:32 +020027#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
28#define rerere(flags) repo_rerere(the_repository, flags)
29#endif
30int repo_rerere(struct repository *, int);
Junio C Hamano1d51ece2015-07-04 17:38:34 -070031/*
32 * Given the conflict ID and the name of a "file" used for replaying
33 * the recorded resolution (e.g. "preimage", "postimage"), return the
34 * path to that filesystem entity. With "file" specified with NULL,
35 * return the path to the directory that houses these files.
36 */
Nguyễn Thái Ngọc Duyd2865da2018-06-30 11:20:28 +020037const char *rerere_path(const struct rerere_id *, const char *file);
Nguyễn Thái Ngọc Duy35843b12018-09-21 17:57:32 +020038int rerere_forget(struct repository *, struct pathspec *);
39int rerere_remaining(struct repository *, struct string_list *);
Nguyễn Thái Ngọc Duy55e6b352018-11-10 06:49:09 +010040void rerere_clear(struct repository *, struct string_list *);
41void rerere_gc(struct repository *, struct string_list *);
Stephan Beyer5b2fd952008-07-09 14:58:57 +020042
Junio C Hamanocb6020b2009-12-04 00:20:48 -080043#define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, "rerere-autoupdate", (v), \
Matthias Ruester3424a022014-09-15 00:40:53 +020044 N_("update the index with reused conflict resolution if possible"))
Junio C Hamanocb6020b2009-12-04 00:20:48 -080045
Stephan Beyer5b2fd952008-07-09 14:58:57 +020046#endif