]>
Commit | Line | Data |
---|---|---|
18b00406 ET |
1 | /* |
2 | * Copyright (C) the libgit2 contributors. All rights reserved. | |
3 | * | |
4 | * This file is part of libgit2, distributed under the GNU GPL v2 with | |
5 | * a Linking Exception. For full terms see the included COPYING file. | |
6 | */ | |
7 | #ifndef INCLUDE_annotated_commit_h__ | |
8 | #define INCLUDE_annotated_commit_h__ | |
9 | ||
eae0bfdc PP |
10 | #include "common.h" |
11 | ||
76ade3a0 ET |
12 | #include "oidarray.h" |
13 | ||
18b00406 ET |
14 | #include "git2/oid.h" |
15 | ||
76ade3a0 ET |
16 | typedef enum { |
17 | GIT_ANNOTATED_COMMIT_REAL = 1, | |
18 | GIT_ANNOTATED_COMMIT_VIRTUAL = 2, | |
19 | } git_annotated_commit_t; | |
20 | ||
21 | /** | |
22 | * Internal structure for merge inputs. An annotated commit is generally | |
23 | * "real" and backed by an actual commit in the repository, but merge will | |
24 | * internally create "virtual" commits that are in-memory intermediate | |
25 | * commits backed by an index. | |
26 | */ | |
18b00406 | 27 | struct git_annotated_commit { |
76ade3a0 ET |
28 | git_annotated_commit_t type; |
29 | ||
30 | /* real commit */ | |
18b00406 | 31 | git_commit *commit; |
76ade3a0 ET |
32 | git_tree *tree; |
33 | ||
34 | /* virtual commit structure */ | |
35 | git_index *index; | |
36 | git_array_oid_t parents; | |
18b00406 | 37 | |
d5592378 ET |
38 | /* how this commit was looked up */ |
39 | const char *description; | |
40 | ||
41 | const char *ref_name; | |
42 | const char *remote_url; | |
18b00406 ET |
43 | |
44 | char id_str[GIT_OID_HEXSZ+1]; | |
45 | }; | |
46 | ||
3f2bb387 ET |
47 | extern int git_annotated_commit_from_head(git_annotated_commit **out, |
48 | git_repository *repo); | |
7730fe8e ET |
49 | extern int git_annotated_commit_from_commit(git_annotated_commit **out, |
50 | git_commit *commit); | |
3f2bb387 | 51 | |
18b00406 | 52 | #endif |