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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
/**
* @file git2/describe.h
* @brief Git describing routines
* @defgroup git_describe Git describing routines
* @ingroup Git
* @{
*/
/**
* Reference lookup strategy
*
* These behave like the --tags and --all options to git-describe,
* namely they say to look for any reference in either refs/tags/ or
* refs/ respectively.
*/
typedef enum git_describe_strategy_t;
/**
* Describe options structure
*
* Initialize with `GIT_DESCRIBE_OPTIONS_INIT`. Alternatively, you can
* use `git_describe_options_init`.
*
*/
typedef struct git_describe_options git_describe_options;
/**
* Initialize git_describe_options structure
*
* Initializes a `git_describe_options` with default values. Equivalent to creating
* an instance with GIT_DESCRIBE_OPTIONS_INIT.
*
* @param opts The `git_describe_options` struct to initialize.
* @param version The struct version; pass `GIT_DESCRIBE_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
;
/**
* Describe format options structure
*
* Initialize with `GIT_DESCRIBE_FORMAT_OPTIONS_INIT`. Alternatively, you can
* use `git_describe_format_options_init`.
*
*/
typedef struct git_describe_format_options;
/**
* Initialize git_describe_format_options structure
*
* Initializes a `git_describe_format_options` with default values. Equivalent to creating
* an instance with GIT_DESCRIBE_FORMAT_OPTIONS_INIT.
*
* @param opts The `git_describe_format_options` struct to initialize.
* @param version The struct version; pass `GIT_DESCRIBE_FORMAT_OPTIONS_VERSION`.
* @return Zero on success; -1 on failure.
*/
;
/**
* A struct that stores the result of a describe operation.
*/
typedef struct git_describe_result git_describe_result;
/**
* Describe a commit
*
* Perform the describe operation on the given committish object.
*
* @param result pointer to store the result. You must free this once
* you're done with it.
* @param committish a committish to describe
* @param opts the lookup options (or NULL for defaults)
*/
;
/**
* Describe a commit
*
* Perform the describe operation on the current commit and the
* worktree. After peforming describe on HEAD, a status is run and the
* description is considered to be dirty if there are.
*
* @param out pointer to store the result. You must free this once
* you're done with it.
* @param repo the repository in which to perform the describe
* @param opts the lookup options (or NULL for defaults)
*/
;
/**
* Print the describe result to a buffer
*
* @param out The buffer to store the result
* @param result the result from `git_describe_commit()` or
* `git_describe_workdir()`.
* @param opts the formatting options (or NULL for defaults)
*/
;
/**
* Free the describe result.
*/
;
/** @} */