blob: 5d6cb638793a4982e6b1e2cd1960dbb6ce0e6dd6 [file] [log] [blame]
Stephan Beyer5b2fd952008-07-09 14:58:57 +02001#ifndef RERERE_H
2#define RERERE_H
3
Elijah Newrenf394e092023-03-21 06:25:54 +00004#include "gettext.h"
Johannes Schindelinc455c872008-07-21 19:03:49 +01005#include "string-list.h"
Stephan Beyer5b2fd952008-07-09 14:58:57 +02006
Nguyễn Thái Ngọc Duy01a10b02013-07-14 15:35:40 +07007struct pathspec;
Nguyễn Thái Ngọc Duy35843b12018-09-21 17:57:32 +02008struct repository;
Nguyễn Thái Ngọc Duy01a10b02013-07-14 15:35:40 +07009
Junio C Hamanocb6020b2009-12-04 00:20:48 -080010#define RERERE_AUTOUPDATE 01
11#define RERERE_NOAUTOUPDATE 02
Jeff King9dd330e2015-09-01 18:14:09 -040012#define RERERE_READONLY 04
Junio C Hamanocb6020b2009-12-04 00:20:48 -080013
Martin von Zweigbergkac49f5c2011-02-16 05:47:44 -050014/*
15 * Marks paths that have been hand-resolved and added to the
16 * index. Set in the util field of such paths after calling
17 * rerere_remaining.
18 */
19extern void *RERERE_RESOLVED;
20
Junio C Hamano1869bbe2015-07-16 14:50:05 -070021struct rerere_dir;
Junio C Hamano1d51ece2015-07-04 17:38:34 -070022struct rerere_id {
Junio C Hamano1869bbe2015-07-16 14:50:05 -070023 struct rerere_dir *collection;
Junio C Hamanoa13d1372015-07-23 14:23:24 -070024 int variant;
Junio C Hamano1d51ece2015-07-04 17:38:34 -070025};
26
Nguyễn Thái Ngọc Duy55e6b352018-11-10 06:49:09 +010027int setup_rerere(struct repository *,struct string_list *, int);
Nguyễn Thái Ngọc Duy35843b12018-09-21 17:57:32 +020028int repo_rerere(struct repository *, int);
Junio C Hamano1d51ece2015-07-04 17:38:34 -070029/*
30 * Given the conflict ID and the name of a "file" used for replaying
31 * the recorded resolution (e.g. "preimage", "postimage"), return the
32 * path to that filesystem entity. With "file" specified with NULL,
33 * return the path to the directory that houses these files.
34 */
Nguyễn Thái Ngọc Duyd2865da2018-06-30 11:20:28 +020035const char *rerere_path(const struct rerere_id *, const char *file);
Nguyễn Thái Ngọc Duy35843b12018-09-21 17:57:32 +020036int rerere_forget(struct repository *, struct pathspec *);
37int rerere_remaining(struct repository *, struct string_list *);
Nguyễn Thái Ngọc Duy55e6b352018-11-10 06:49:09 +010038void rerere_clear(struct repository *, struct string_list *);
39void rerere_gc(struct repository *, struct string_list *);
Stephan Beyer5b2fd952008-07-09 14:58:57 +020040
Junio C Hamanocb6020b2009-12-04 00:20:48 -080041#define OPT_RERERE_AUTOUPDATE(v) OPT_UYN(0, "rerere-autoupdate", (v), \
Matthias Ruester3424a022014-09-15 00:40:53 +020042 N_("update the index with reused conflict resolution if possible"))
Junio C Hamanocb6020b2009-12-04 00:20:48 -080043
Stephan Beyer5b2fd952008-07-09 14:58:57 +020044#endif