1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
| | #ifndef METACOMMIT_H
#define METACOMMIT_H
#include "hash.h"
#include "oid-array.h"
#include "repository.h"
#include "string-list.h"
struct change_table;
/* If specified, non-fast-forward changes are permitted. */
#define UPDATE_OPTION_FORCE 0x0001
/**
* If specified, no attempt will be made to append to existing changes.
* Normally, if a metacommit points to a commit in its replace or origin
* list and an existing change points to that same commit as its content, the
* new metacommit will attempt to append to that same change. This may replace
* the commit parent with one or more metacommits from the head of the appended
* changes. This option disables this behavior, and will always create a new
* change rather than reusing existing changes.
*/
#define UPDATE_OPTION_NOAPPEND 0x0002
/* Metacommit Data */
struct metacommit_data {
struct object_id content;
struct oid_array replace;
struct oid_array origin;
int abandoned;
};
extern void init_metacommit_data(struct metacommit_data *state);
extern void clear_metacommit_data(struct metacommit_data *state);
extern int record_metacommit(struct repository *repo,
const struct metacommit_data *metacommit,
const char* override_change, int options, struct strbuf *err);
extern int record_metacommit_withresult(
struct repository *repo,
struct change_table *chtable,
const struct metacommit_data *metacommit,
const char *override_change,
int options,
struct strbuf *err,
struct string_list *changes);
extern void modify_change(struct repository *repo,
const struct object_id *old_commit, const struct object_id *new_commit,
struct strbuf *err);
extern int write_metacommit(struct repository *repo, struct metacommit_data *state,
struct object_id *result);
#endif
|