2009-12-25 08:30:51 +00:00
|
|
|
#ifndef RESOLVE_UNDO_H
|
|
|
|
#define RESOLVE_UNDO_H
|
|
|
|
|
2023-04-11 07:42:03 +00:00
|
|
|
struct cache_entry;
|
|
|
|
struct index_state;
|
|
|
|
struct pathspec;
|
|
|
|
struct string_list;
|
|
|
|
|
2023-04-22 20:17:20 +00:00
|
|
|
#include "hash-ll.h"
|
2018-08-15 17:54:05 +00:00
|
|
|
|
2009-12-25 08:30:51 +00:00
|
|
|
struct resolve_undo_info {
|
|
|
|
unsigned int mode[3];
|
2018-03-12 02:27:25 +00:00
|
|
|
struct object_id oid[3];
|
2009-12-25 08:30:51 +00:00
|
|
|
};
|
|
|
|
|
2019-04-29 08:28:14 +00:00
|
|
|
void record_resolve_undo(struct index_state *, struct cache_entry *);
|
|
|
|
void resolve_undo_write(struct strbuf *, struct string_list *);
|
|
|
|
struct string_list *resolve_undo_read(const char *, unsigned long);
|
|
|
|
void resolve_undo_clear_index(struct index_state *);
|
|
|
|
int unmerge_index_entry_at(struct index_state *, int);
|
resolve-undo: allow resurrecting conflicted state that resolved to deletion
The resolve-undo index extension records up to three (mode, object
name) tuples for non-zero stages for each path that was resolved,
to be used to recreate the original conflicted state later when the
user requests.
The unmerge_index_entry_at() function uses the resolve-undo data to
do so, but it assumes that the path for which the conflicted state
needs to be recreated can be specified by the position in the
active_cache[] array. This obviously cannot salvage the state of
conflicted paths that were resolved by removing them. For example,
a delete-modify conflict, in which the change whose "modify" side
made is a trivial typofix, may legitimately be resolved to remove
the path, and resolve-undo extension does record the two (mode,
object name) tuples for the common ancestor version and their
version, lacking our version. But after recording such a removal of
the path, you should be able to use resolve-undo data to recreate
the conflicted state.
Introduce a new unmerge_index_entry() helper function that takes the
path (which does not necessarily have to exist in the active_cache[]
array) and resolve-undo data, and use it to reimplement unmerge_index()
public function that is used by "git rerere".
The limited interface is still kept for now, as it is used by "git
checkout -m" and "git update-index --unmerge", but these two codepaths
will be updated to lift the assumption to allow conflicts that resolved
to deletion can be recreated.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-07-31 22:44:04 +00:00
|
|
|
int unmerge_index_entry(struct index_state *, const char *, struct resolve_undo_info *);
|
2019-04-29 08:28:14 +00:00
|
|
|
void unmerge_index(struct index_state *, const struct pathspec *);
|
|
|
|
void unmerge_marked_index(struct index_state *);
|
2009-12-25 08:30:51 +00:00
|
|
|
|
|
|
|
#endif
|