]> git.proxmox.com Git - cargo.git/blob - vendor/libgit2-sys/lib.rs
New upstream version 0.66.0
[cargo.git] / vendor / libgit2-sys / lib.rs
1 #![doc(html_root_url = "https://docs.rs/libgit2-sys/0.14")]
2 #![allow(non_camel_case_types, unused_extern_crates)]
3
4 // This is required to link libz when libssh2-sys is not included.
5 extern crate libz_sys as libz;
6
7 use libc::{c_char, c_int, c_uchar, c_uint, c_void, size_t};
8 #[cfg(feature = "ssh")]
9 use libssh2_sys as libssh2;
10 use std::ffi::CStr;
11
12 pub const GIT_OID_RAWSZ: usize = 20;
13 pub const GIT_OID_HEXSZ: usize = GIT_OID_RAWSZ * 2;
14 pub const GIT_CLONE_OPTIONS_VERSION: c_uint = 1;
15 pub const GIT_STASH_APPLY_OPTIONS_VERSION: c_uint = 1;
16 pub const GIT_CHECKOUT_OPTIONS_VERSION: c_uint = 1;
17 pub const GIT_MERGE_OPTIONS_VERSION: c_uint = 1;
18 pub const GIT_REMOTE_CALLBACKS_VERSION: c_uint = 1;
19 pub const GIT_STATUS_OPTIONS_VERSION: c_uint = 1;
20 pub const GIT_BLAME_OPTIONS_VERSION: c_uint = 1;
21 pub const GIT_PROXY_OPTIONS_VERSION: c_uint = 1;
22 pub const GIT_SUBMODULE_UPDATE_OPTIONS_VERSION: c_uint = 1;
23 pub const GIT_ODB_BACKEND_VERSION: c_uint = 1;
24 pub const GIT_REFDB_BACKEND_VERSION: c_uint = 1;
25 pub const GIT_CHERRYPICK_OPTIONS_VERSION: c_uint = 1;
26 pub const GIT_APPLY_OPTIONS_VERSION: c_uint = 1;
27 pub const GIT_REVERT_OPTIONS_VERSION: c_uint = 1;
28
29 macro_rules! git_enum {
30 (pub enum $name:ident { $($variants:tt)* }) => {
31 #[cfg(target_env = "msvc")]
32 pub type $name = i32;
33 #[cfg(not(target_env = "msvc"))]
34 pub type $name = u32;
35 git_enum!(gen, $name, 0, $($variants)*);
36 };
37 (pub enum $name:ident: $t:ty { $($variants:tt)* }) => {
38 pub type $name = $t;
39 git_enum!(gen, $name, 0, $($variants)*);
40 };
41 (gen, $name:ident, $val:expr, $variant:ident, $($rest:tt)*) => {
42 pub const $variant: $name = $val;
43 git_enum!(gen, $name, $val+1, $($rest)*);
44 };
45 (gen, $name:ident, $val:expr, $variant:ident = $e:expr, $($rest:tt)*) => {
46 pub const $variant: $name = $e;
47 git_enum!(gen, $name, $e+1, $($rest)*);
48 };
49 (gen, $name:ident, $val:expr, ) => {}
50 }
51
52 pub enum git_blob {}
53 pub enum git_branch_iterator {}
54 pub enum git_blame {}
55 pub enum git_commit {}
56 pub enum git_config {}
57 pub enum git_config_iterator {}
58 pub enum git_index {}
59 pub enum git_index_conflict_iterator {}
60 pub enum git_object {}
61 pub enum git_reference {}
62 pub enum git_reference_iterator {}
63 pub enum git_annotated_commit {}
64 pub enum git_refdb {}
65 pub enum git_refspec {}
66 pub enum git_remote {}
67 pub enum git_repository {}
68 pub enum git_revwalk {}
69 pub enum git_submodule {}
70 pub enum git_tag {}
71 pub enum git_tree {}
72 pub enum git_tree_entry {}
73 pub enum git_treebuilder {}
74 pub enum git_push {}
75 pub enum git_note {}
76 pub enum git_note_iterator {}
77 pub enum git_status_list {}
78 pub enum git_pathspec {}
79 pub enum git_pathspec_match_list {}
80 pub enum git_diff {}
81 pub enum git_diff_stats {}
82 pub enum git_patch {}
83 pub enum git_rebase {}
84 pub enum git_reflog {}
85 pub enum git_reflog_entry {}
86 pub enum git_describe_result {}
87 pub enum git_packbuilder {}
88 pub enum git_odb {}
89 pub enum git_odb_stream {}
90 pub enum git_odb_object {}
91 pub enum git_worktree {}
92 pub enum git_transaction {}
93 pub enum git_mailmap {}
94
95 #[repr(C)]
96 pub struct git_revspec {
97 pub from: *mut git_object,
98 pub to: *mut git_object,
99 pub flags: c_uint,
100 }
101
102 #[repr(C)]
103 pub struct git_error {
104 pub message: *mut c_char,
105 pub klass: c_int,
106 }
107
108 #[repr(C)]
109 #[derive(Copy, Clone)]
110 pub struct git_oid {
111 pub id: [u8; GIT_OID_RAWSZ],
112 }
113
114 #[repr(C)]
115 #[derive(Copy)]
116 pub struct git_strarray {
117 pub strings: *mut *mut c_char,
118 pub count: size_t,
119 }
120 impl Clone for git_strarray {
121 fn clone(&self) -> git_strarray {
122 *self
123 }
124 }
125
126 #[repr(C)]
127 #[derive(Copy)]
128 pub struct git_oidarray {
129 pub ids: *mut git_oid,
130 pub count: size_t,
131 }
132 impl Clone for git_oidarray {
133 fn clone(&self) -> git_oidarray {
134 *self
135 }
136 }
137
138 #[repr(C)]
139 pub struct git_signature {
140 pub name: *mut c_char,
141 pub email: *mut c_char,
142 pub when: git_time,
143 }
144
145 #[repr(C)]
146 #[derive(Copy, Clone, Debug, Eq, PartialEq)]
147 pub struct git_time {
148 pub time: git_time_t,
149 pub offset: c_int,
150 pub sign: c_char,
151 }
152
153 pub type git_off_t = i64;
154 pub type git_time_t = i64;
155 pub type git_object_size_t = u64;
156
157 git_enum! {
158 pub enum git_revparse_mode_t {
159 GIT_REVPARSE_SINGLE = 1 << 0,
160 GIT_REVPARSE_RANGE = 1 << 1,
161 GIT_REVPARSE_MERGE_BASE = 1 << 2,
162 }
163 }
164
165 git_enum! {
166 pub enum git_error_code: c_int {
167 GIT_OK = 0,
168
169 GIT_ERROR = -1,
170 GIT_ENOTFOUND = -3,
171 GIT_EEXISTS = -4,
172 GIT_EAMBIGUOUS = -5,
173 GIT_EBUFS = -6,
174 GIT_EUSER = -7,
175 GIT_EBAREREPO = -8,
176 GIT_EUNBORNBRANCH = -9,
177 GIT_EUNMERGED = -10,
178 GIT_ENONFASTFORWARD = -11,
179 GIT_EINVALIDSPEC = -12,
180 GIT_ECONFLICT = -13,
181 GIT_ELOCKED = -14,
182 GIT_EMODIFIED = -15,
183 GIT_EAUTH = -16,
184 GIT_ECERTIFICATE = -17,
185 GIT_EAPPLIED = -18,
186 GIT_EPEEL = -19,
187 GIT_EEOF = -20,
188 GIT_EINVALID = -21,
189 GIT_EUNCOMMITTED = -22,
190 GIT_EDIRECTORY = -23,
191 GIT_EMERGECONFLICT = -24,
192 GIT_PASSTHROUGH = -30,
193 GIT_ITEROVER = -31,
194 GIT_RETRY = -32,
195 GIT_EMISMATCH = -33,
196 GIT_EINDEXDIRTY = -34,
197 GIT_EAPPLYFAIL = -35,
198 GIT_EOWNER = -36,
199 }
200 }
201
202 git_enum! {
203 pub enum git_error_t {
204 GIT_ERROR_NONE = 0,
205 GIT_ERROR_NOMEMORY,
206 GIT_ERROR_OS,
207 GIT_ERROR_INVALID,
208 GIT_ERROR_REFERENCE,
209 GIT_ERROR_ZLIB,
210 GIT_ERROR_REPOSITORY,
211 GIT_ERROR_CONFIG,
212 GIT_ERROR_REGEX,
213 GIT_ERROR_ODB,
214 GIT_ERROR_INDEX,
215 GIT_ERROR_OBJECT,
216 GIT_ERROR_NET,
217 GIT_ERROR_TAG,
218 GIT_ERROR_TREE,
219 GIT_ERROR_INDEXER,
220 GIT_ERROR_SSL,
221 GIT_ERROR_SUBMODULE,
222 GIT_ERROR_THREAD,
223 GIT_ERROR_STASH,
224 GIT_ERROR_CHECKOUT,
225 GIT_ERROR_FETCHHEAD,
226 GIT_ERROR_MERGE,
227 GIT_ERROR_SSH,
228 GIT_ERROR_FILTER,
229 GIT_ERROR_REVERT,
230 GIT_ERROR_CALLBACK,
231 GIT_ERROR_CHERRYPICK,
232 GIT_ERROR_DESCRIBE,
233 GIT_ERROR_REBASE,
234 GIT_ERROR_FILESYSTEM,
235 GIT_ERROR_PATCH,
236 GIT_ERROR_WORKTREE,
237 GIT_ERROR_SHA1,
238 GIT_ERROR_HTTP,
239 }
240 }
241
242 git_enum! {
243 pub enum git_repository_state_t {
244 GIT_REPOSITORY_STATE_NONE,
245 GIT_REPOSITORY_STATE_MERGE,
246 GIT_REPOSITORY_STATE_REVERT,
247 GIT_REPOSITORY_STATE_REVERT_SEQUENCE,
248 GIT_REPOSITORY_STATE_CHERRYPICK,
249 GIT_REPOSITORY_STATE_CHERRYPICK_SEQUENCE,
250 GIT_REPOSITORY_STATE_BISECT,
251 GIT_REPOSITORY_STATE_REBASE,
252 GIT_REPOSITORY_STATE_REBASE_INTERACTIVE,
253 GIT_REPOSITORY_STATE_REBASE_MERGE,
254 GIT_REPOSITORY_STATE_APPLY_MAILBOX,
255 GIT_REPOSITORY_STATE_APPLY_MAILBOX_OR_REBASE,
256 }
257 }
258
259 git_enum! {
260 pub enum git_direction {
261 GIT_DIRECTION_FETCH,
262 GIT_DIRECTION_PUSH,
263 }
264 }
265
266 #[repr(C)]
267 pub struct git_clone_options {
268 pub version: c_uint,
269 pub checkout_opts: git_checkout_options,
270 pub fetch_opts: git_fetch_options,
271 pub bare: c_int,
272 pub local: git_clone_local_t,
273 pub checkout_branch: *const c_char,
274 pub repository_cb: git_repository_create_cb,
275 pub repository_cb_payload: *mut c_void,
276 pub remote_cb: git_remote_create_cb,
277 pub remote_cb_payload: *mut c_void,
278 }
279
280 git_enum! {
281 pub enum git_clone_local_t {
282 GIT_CLONE_LOCAL_AUTO,
283 GIT_CLONE_LOCAL,
284 GIT_CLONE_NO_LOCAL,
285 GIT_CLONE_LOCAL_NO_LINKS,
286 }
287 }
288
289 #[repr(C)]
290 pub struct git_checkout_options {
291 pub version: c_uint,
292 pub checkout_strategy: c_uint,
293 pub disable_filters: c_int,
294 pub dir_mode: c_uint,
295 pub file_mode: c_uint,
296 pub file_open_flags: c_int,
297 pub notify_flags: c_uint,
298 pub notify_cb: git_checkout_notify_cb,
299 pub notify_payload: *mut c_void,
300 pub progress_cb: git_checkout_progress_cb,
301 pub progress_payload: *mut c_void,
302 pub paths: git_strarray,
303 pub baseline: *mut git_tree,
304 pub baseline_index: *mut git_index,
305 pub target_directory: *const c_char,
306 pub ancestor_label: *const c_char,
307 pub our_label: *const c_char,
308 pub their_label: *const c_char,
309 pub perfdata_cb: git_checkout_perfdata_cb,
310 pub perfdata_payload: *mut c_void,
311 }
312
313 pub type git_checkout_notify_cb = Option<
314 extern "C" fn(
315 git_checkout_notify_t,
316 *const c_char,
317 *const git_diff_file,
318 *const git_diff_file,
319 *const git_diff_file,
320 *mut c_void,
321 ) -> c_int,
322 >;
323 pub type git_checkout_progress_cb =
324 Option<extern "C" fn(*const c_char, size_t, size_t, *mut c_void)>;
325
326 pub type git_checkout_perfdata_cb =
327 Option<extern "C" fn(*const git_checkout_perfdata, *mut c_void)>;
328
329 #[repr(C)]
330 pub struct git_checkout_perfdata {
331 pub mkdir_calls: size_t,
332 pub stat_calls: size_t,
333 pub chmod_calls: size_t,
334 }
335
336 #[repr(C)]
337 #[derive(Copy, Clone)]
338 pub struct git_indexer_progress {
339 pub total_objects: c_uint,
340 pub indexed_objects: c_uint,
341 pub received_objects: c_uint,
342 pub local_objects: c_uint,
343 pub total_deltas: c_uint,
344 pub indexed_deltas: c_uint,
345 pub received_bytes: size_t,
346 }
347
348 pub type git_indexer_progress_cb =
349 Option<extern "C" fn(*const git_indexer_progress, *mut c_void) -> c_int>;
350
351 #[deprecated(
352 since = "0.10.0",
353 note = "renamed to `git_indexer_progress` to match upstream"
354 )]
355 pub type git_transfer_progress = git_indexer_progress;
356
357 pub type git_remote_ready_cb = Option<extern "C" fn(*mut git_remote, c_int, *mut c_void) -> c_int>;
358
359 #[repr(C)]
360 pub struct git_remote_callbacks {
361 pub version: c_uint,
362 pub sideband_progress: git_transport_message_cb,
363 pub completion: Option<extern "C" fn(git_remote_completion_type, *mut c_void) -> c_int>,
364 pub credentials: git_cred_acquire_cb,
365 pub certificate_check: git_transport_certificate_check_cb,
366 pub transfer_progress: git_indexer_progress_cb,
367 pub update_tips:
368 Option<extern "C" fn(*const c_char, *const git_oid, *const git_oid, *mut c_void) -> c_int>,
369 pub pack_progress: git_packbuilder_progress,
370 pub push_transfer_progress: git_push_transfer_progress,
371 pub push_update_reference: git_push_update_reference_cb,
372 pub push_negotiation: git_push_negotiation,
373 pub transport: git_transport_cb,
374 pub remote_ready: git_remote_ready_cb,
375 pub payload: *mut c_void,
376 pub resolve_url: git_url_resolve_cb,
377 }
378
379 #[repr(C)]
380 pub struct git_fetch_options {
381 pub version: c_int,
382 pub callbacks: git_remote_callbacks,
383 pub prune: git_fetch_prune_t,
384 pub update_fetchhead: c_int,
385 pub download_tags: git_remote_autotag_option_t,
386 pub proxy_opts: git_proxy_options,
387 pub follow_redirects: git_remote_redirect_t,
388 pub custom_headers: git_strarray,
389 }
390
391 git_enum! {
392 pub enum git_remote_autotag_option_t {
393 GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED,
394 GIT_REMOTE_DOWNLOAD_TAGS_AUTO,
395 GIT_REMOTE_DOWNLOAD_TAGS_NONE,
396 GIT_REMOTE_DOWNLOAD_TAGS_ALL,
397 }
398 }
399
400 git_enum! {
401 pub enum git_fetch_prune_t {
402 GIT_FETCH_PRUNE_UNSPECIFIED,
403 GIT_FETCH_PRUNE,
404 GIT_FETCH_NO_PRUNE,
405 }
406 }
407
408 git_enum! {
409 pub enum git_remote_completion_type {
410 GIT_REMOTE_COMPLETION_DOWNLOAD,
411 GIT_REMOTE_COMPLETION_INDEXING,
412 GIT_REMOTE_COMPLETION_ERROR,
413 }
414 }
415
416 pub type git_transport_message_cb =
417 Option<extern "C" fn(*const c_char, c_int, *mut c_void) -> c_int>;
418 pub type git_cred_acquire_cb = Option<
419 extern "C" fn(*mut *mut git_cred, *const c_char, *const c_char, c_uint, *mut c_void) -> c_int,
420 >;
421 pub type git_transfer_progress_cb =
422 Option<extern "C" fn(*const git_indexer_progress, *mut c_void) -> c_int>;
423 pub type git_packbuilder_progress =
424 Option<extern "C" fn(git_packbuilder_stage_t, c_uint, c_uint, *mut c_void) -> c_int>;
425 pub type git_push_transfer_progress =
426 Option<extern "C" fn(c_uint, c_uint, size_t, *mut c_void) -> c_int>;
427 pub type git_transport_certificate_check_cb =
428 Option<extern "C" fn(*mut git_cert, c_int, *const c_char, *mut c_void) -> c_int>;
429 pub type git_push_negotiation =
430 Option<extern "C" fn(*mut *const git_push_update, size_t, *mut c_void) -> c_int>;
431
432 pub type git_push_update_reference_cb =
433 Option<extern "C" fn(*const c_char, *const c_char, *mut c_void) -> c_int>;
434 pub type git_url_resolve_cb =
435 Option<extern "C" fn(*mut git_buf, *const c_char, c_int, *mut c_void) -> c_int>;
436
437 #[repr(C)]
438 pub struct git_push_update {
439 pub src_refname: *mut c_char,
440 pub dst_refname: *mut c_char,
441 pub src: git_oid,
442 pub dst: git_oid,
443 }
444
445 git_enum! {
446 pub enum git_cert_t {
447 GIT_CERT_NONE,
448 GIT_CERT_X509,
449 GIT_CERT_HOSTKEY_LIBSSH2,
450 GIT_CERT_STRARRAY,
451 }
452 }
453
454 #[repr(C)]
455 pub struct git_cert {
456 pub cert_type: git_cert_t,
457 }
458
459 #[repr(C)]
460 pub struct git_cert_hostkey {
461 pub parent: git_cert,
462 pub kind: git_cert_ssh_t,
463 pub hash_md5: [u8; 16],
464 pub hash_sha1: [u8; 20],
465 pub hash_sha256: [u8; 32],
466 pub raw_type: git_cert_ssh_raw_type_t,
467 pub hostkey: *const c_char,
468 pub hostkey_len: size_t,
469 }
470
471 #[repr(C)]
472 pub struct git_cert_x509 {
473 pub parent: git_cert,
474 pub data: *mut c_void,
475 pub len: size_t,
476 }
477
478 git_enum! {
479 pub enum git_cert_ssh_t {
480 GIT_CERT_SSH_MD5 = 1 << 0,
481 GIT_CERT_SSH_SHA1 = 1 << 1,
482 GIT_CERT_SSH_SHA256 = 1 << 2,
483 GIT_CERT_SSH_RAW = 1 << 3,
484 }
485 }
486
487 git_enum! {
488 pub enum git_cert_ssh_raw_type_t {
489 GIT_CERT_SSH_RAW_TYPE_UNKNOWN = 0,
490 GIT_CERT_SSH_RAW_TYPE_RSA = 1,
491 GIT_CERT_SSH_RAW_TYPE_DSS = 2,
492 }
493 }
494
495 git_enum! {
496 pub enum git_diff_flag_t {
497 GIT_DIFF_FLAG_BINARY = 1 << 0,
498 GIT_DIFF_FLAG_NOT_BINARY = 1 << 1,
499 GIT_DIFF_FLAG_VALID_ID = 1 << 2,
500 GIT_DIFF_FLAG_EXISTS = 1 << 3,
501 }
502 }
503
504 #[repr(C)]
505 pub struct git_diff_file {
506 pub id: git_oid,
507 pub path: *const c_char,
508 pub size: git_object_size_t,
509 pub flags: u32,
510 pub mode: u16,
511 pub id_abbrev: u16,
512 }
513
514 pub type git_repository_create_cb =
515 Option<extern "C" fn(*mut *mut git_repository, *const c_char, c_int, *mut c_void) -> c_int>;
516 pub type git_remote_create_cb = Option<
517 extern "C" fn(
518 *mut *mut git_remote,
519 *mut git_repository,
520 *const c_char,
521 *const c_char,
522 *mut c_void,
523 ) -> c_int,
524 >;
525
526 git_enum! {
527 pub enum git_checkout_notify_t {
528 GIT_CHECKOUT_NOTIFY_NONE = 0,
529 GIT_CHECKOUT_NOTIFY_CONFLICT = 1 << 0,
530 GIT_CHECKOUT_NOTIFY_DIRTY = 1 << 1,
531 GIT_CHECKOUT_NOTIFY_UPDATED = 1 << 2,
532 GIT_CHECKOUT_NOTIFY_UNTRACKED = 1 << 3,
533 GIT_CHECKOUT_NOTIFY_IGNORED = 1 << 4,
534
535 GIT_CHECKOUT_NOTIFY_ALL = 0x0FFFF,
536 }
537 }
538
539 git_enum! {
540 pub enum git_status_t {
541 GIT_STATUS_CURRENT = 0,
542
543 GIT_STATUS_INDEX_NEW = 1 << 0,
544 GIT_STATUS_INDEX_MODIFIED = 1 << 1,
545 GIT_STATUS_INDEX_DELETED = 1 << 2,
546 GIT_STATUS_INDEX_RENAMED = 1 << 3,
547 GIT_STATUS_INDEX_TYPECHANGE = 1 << 4,
548
549 GIT_STATUS_WT_NEW = 1 << 7,
550 GIT_STATUS_WT_MODIFIED = 1 << 8,
551 GIT_STATUS_WT_DELETED = 1 << 9,
552 GIT_STATUS_WT_TYPECHANGE = 1 << 10,
553 GIT_STATUS_WT_RENAMED = 1 << 11,
554 GIT_STATUS_WT_UNREADABLE = 1 << 12,
555
556 GIT_STATUS_IGNORED = 1 << 14,
557 GIT_STATUS_CONFLICTED = 1 << 15,
558 }
559 }
560
561 git_enum! {
562 pub enum git_status_opt_t {
563 GIT_STATUS_OPT_INCLUDE_UNTRACKED = 1 << 0,
564 GIT_STATUS_OPT_INCLUDE_IGNORED = 1 << 1,
565 GIT_STATUS_OPT_INCLUDE_UNMODIFIED = 1 << 2,
566 GIT_STATUS_OPT_EXCLUDE_SUBMODULES = 1 << 3,
567 GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = 1 << 4,
568 GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = 1 << 5,
569 GIT_STATUS_OPT_RECURSE_IGNORED_DIRS = 1 << 6,
570 GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX = 1 << 7,
571 GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR = 1 << 8,
572 GIT_STATUS_OPT_SORT_CASE_SENSITIVELY = 1 << 9,
573 GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY = 1 << 10,
574
575 GIT_STATUS_OPT_RENAMES_FROM_REWRITES = 1 << 11,
576 GIT_STATUS_OPT_NO_REFRESH = 1 << 12,
577 GIT_STATUS_OPT_UPDATE_INDEX = 1 << 13,
578 GIT_STATUS_OPT_INCLUDE_UNREADABLE = 1 << 14,
579 GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKED = 1 << 15,
580 }
581 }
582
583 git_enum! {
584 pub enum git_status_show_t {
585 GIT_STATUS_SHOW_INDEX_AND_WORKDIR = 0,
586 GIT_STATUS_SHOW_INDEX_ONLY = 1,
587 GIT_STATUS_SHOW_WORKDIR_ONLY = 2,
588 }
589 }
590
591 git_enum! {
592 pub enum git_delta_t {
593 GIT_DELTA_UNMODIFIED,
594 GIT_DELTA_ADDED,
595 GIT_DELTA_DELETED,
596 GIT_DELTA_MODIFIED,
597 GIT_DELTA_RENAMED,
598 GIT_DELTA_COPIED,
599 GIT_DELTA_IGNORED,
600 GIT_DELTA_UNTRACKED,
601 GIT_DELTA_TYPECHANGE,
602 GIT_DELTA_UNREADABLE,
603 GIT_DELTA_CONFLICTED,
604 }
605 }
606
607 #[repr(C)]
608 pub struct git_status_options {
609 pub version: c_uint,
610 pub show: git_status_show_t,
611 pub flags: c_uint,
612 pub pathspec: git_strarray,
613 pub baseline: *mut git_tree,
614 pub rename_threshold: u16,
615 }
616
617 #[repr(C)]
618 pub struct git_diff_delta {
619 pub status: git_delta_t,
620 pub flags: u32,
621 pub similarity: u16,
622 pub nfiles: u16,
623 pub old_file: git_diff_file,
624 pub new_file: git_diff_file,
625 }
626
627 #[repr(C)]
628 pub struct git_status_entry {
629 pub status: git_status_t,
630 pub head_to_index: *mut git_diff_delta,
631 pub index_to_workdir: *mut git_diff_delta,
632 }
633
634 git_enum! {
635 pub enum git_checkout_strategy_t {
636 GIT_CHECKOUT_NONE = 0,
637 GIT_CHECKOUT_SAFE = 1 << 0,
638 GIT_CHECKOUT_FORCE = 1 << 1,
639 GIT_CHECKOUT_RECREATE_MISSING = 1 << 2,
640 GIT_CHECKOUT_ALLOW_CONFLICTS = 1 << 4,
641 GIT_CHECKOUT_REMOVE_UNTRACKED = 1 << 5,
642 GIT_CHECKOUT_REMOVE_IGNORED = 1 << 6,
643 GIT_CHECKOUT_UPDATE_ONLY = 1 << 7,
644 GIT_CHECKOUT_DONT_UPDATE_INDEX = 1 << 8,
645 GIT_CHECKOUT_NO_REFRESH = 1 << 9,
646 GIT_CHECKOUT_SKIP_UNMERGED = 1 << 10,
647 GIT_CHECKOUT_USE_OURS = 1 << 11,
648 GIT_CHECKOUT_USE_THEIRS = 1 << 12,
649 GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH = 1 << 13,
650 GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES = 1 << 18,
651 GIT_CHECKOUT_DONT_OVERWRITE_IGNORED = 1 << 19,
652 GIT_CHECKOUT_CONFLICT_STYLE_MERGE = 1 << 20,
653 GIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = 1 << 21,
654
655 GIT_CHECKOUT_UPDATE_SUBMODULES = 1 << 16,
656 GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = 1 << 17,
657 }
658 }
659
660 git_enum! {
661 pub enum git_reset_t {
662 GIT_RESET_SOFT = 1,
663 GIT_RESET_MIXED = 2,
664 GIT_RESET_HARD = 3,
665 }
666 }
667
668 git_enum! {
669 pub enum git_object_t: c_int {
670 GIT_OBJECT_ANY = -2,
671 GIT_OBJECT_INVALID = -1,
672 GIT_OBJECT_COMMIT = 1,
673 GIT_OBJECT_TREE = 2,
674 GIT_OBJECT_BLOB = 3,
675 GIT_OBJECT_TAG = 4,
676 GIT_OBJECT_OFS_DELTA = 6,
677 GIT_OBJECT_REF_DELTA = 7,
678 }
679 }
680
681 git_enum! {
682 pub enum git_reference_t {
683 GIT_REFERENCE_INVALID = 0,
684 GIT_REFERENCE_DIRECT = 1,
685 GIT_REFERENCE_SYMBOLIC = 2,
686 GIT_REFERENCE_ALL = GIT_REFERENCE_DIRECT | GIT_REFERENCE_SYMBOLIC,
687 }
688 }
689
690 git_enum! {
691 pub enum git_filemode_t {
692 GIT_FILEMODE_UNREADABLE = 0o000000,
693 GIT_FILEMODE_TREE = 0o040000,
694 GIT_FILEMODE_BLOB = 0o100644,
695 GIT_FILEMODE_BLOB_EXECUTABLE = 0o100755,
696 GIT_FILEMODE_LINK = 0o120000,
697 GIT_FILEMODE_COMMIT = 0o160000,
698 }
699 }
700
701 git_enum! {
702 pub enum git_treewalk_mode {
703 GIT_TREEWALK_PRE = 0,
704 GIT_TREEWALK_POST = 1,
705 }
706 }
707
708 pub type git_treewalk_cb =
709 Option<extern "C" fn(*const c_char, *const git_tree_entry, *mut c_void) -> c_int>;
710 pub type git_treebuilder_filter_cb =
711 Option<extern "C" fn(*const git_tree_entry, *mut c_void) -> c_int>;
712
713 pub type git_revwalk_hide_cb = Option<extern "C" fn(*const git_oid, *mut c_void) -> c_int>;
714
715 git_enum! {
716 pub enum git_tree_update_t {
717 GIT_TREE_UPDATE_UPSERT = 0,
718 GIT_TREE_UPDATE_REMOVE = 1,
719 }
720 }
721
722 #[repr(C)]
723 pub struct git_tree_update {
724 pub action: git_tree_update_t,
725 pub id: git_oid,
726 pub filemode: git_filemode_t,
727 pub path: *const c_char,
728 }
729
730 #[repr(C)]
731 #[derive(Copy, Clone)]
732 pub struct git_buf {
733 pub ptr: *mut c_char,
734 pub reserved: size_t,
735 pub size: size_t,
736 }
737
738 git_enum! {
739 pub enum git_branch_t {
740 GIT_BRANCH_LOCAL = 1,
741 GIT_BRANCH_REMOTE = 2,
742 GIT_BRANCH_ALL = GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE,
743 }
744 }
745
746 pub const GIT_BLAME_NORMAL: u32 = 0;
747 pub const GIT_BLAME_TRACK_COPIES_SAME_FILE: u32 = 1 << 0;
748 pub const GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES: u32 = 1 << 1;
749 pub const GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES: u32 = 1 << 2;
750 pub const GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES: u32 = 1 << 3;
751 pub const GIT_BLAME_FIRST_PARENT: u32 = 1 << 4;
752 pub const GIT_BLAME_USE_MAILMAP: u32 = 1 << 5;
753 pub const GIT_BLAME_IGNORE_WHITESPACE: u32 = 1 << 6;
754
755 #[repr(C)]
756 #[derive(Copy, Clone)]
757 pub struct git_blame_options {
758 pub version: c_uint,
759
760 pub flags: u32,
761 pub min_match_characters: u16,
762 pub newest_commit: git_oid,
763 pub oldest_commit: git_oid,
764 pub min_line: usize,
765 pub max_line: usize,
766 }
767
768 #[repr(C)]
769 #[derive(Copy, Clone)]
770 pub struct git_blame_hunk {
771 pub lines_in_hunk: usize,
772 pub final_commit_id: git_oid,
773 pub final_start_line_number: usize,
774 pub final_signature: *mut git_signature,
775 pub orig_commit_id: git_oid,
776 pub orig_path: *const c_char,
777 pub orig_start_line_number: usize,
778 pub orig_signature: *mut git_signature,
779 pub boundary: c_char,
780 }
781
782 pub type git_index_matched_path_cb =
783 Option<extern "C" fn(*const c_char, *const c_char, *mut c_void) -> c_int>;
784
785 git_enum! {
786 pub enum git_index_entry_extended_flag_t {
787 GIT_INDEX_ENTRY_INTENT_TO_ADD = 1 << 13,
788 GIT_INDEX_ENTRY_SKIP_WORKTREE = 1 << 14,
789
790 GIT_INDEX_ENTRY_UPTODATE = 1 << 2,
791 }
792 }
793
794 git_enum! {
795 pub enum git_index_entry_flag_t {
796 GIT_INDEX_ENTRY_EXTENDED = 0x4000,
797 GIT_INDEX_ENTRY_VALID = 0x8000,
798 }
799 }
800
801 #[repr(C)]
802 #[derive(Copy, Clone)]
803 pub struct git_index_entry {
804 pub ctime: git_index_time,
805 pub mtime: git_index_time,
806 pub dev: u32,
807 pub ino: u32,
808 pub mode: u32,
809 pub uid: u32,
810 pub gid: u32,
811 pub file_size: u32,
812 pub id: git_oid,
813 pub flags: u16,
814 pub flags_extended: u16,
815 pub path: *const c_char,
816 }
817
818 pub const GIT_INDEX_ENTRY_NAMEMASK: u16 = 0xfff;
819 pub const GIT_INDEX_ENTRY_STAGEMASK: u16 = 0x3000;
820 pub const GIT_INDEX_ENTRY_STAGESHIFT: u16 = 12;
821
822 #[repr(C)]
823 #[derive(Copy, Clone, Debug, Eq, PartialEq)]
824 pub struct git_index_time {
825 pub seconds: i32,
826 pub nanoseconds: u32,
827 }
828
829 #[repr(C)]
830 pub struct git_config_entry {
831 pub name: *const c_char,
832 pub value: *const c_char,
833 pub include_depth: c_uint,
834 pub level: git_config_level_t,
835 pub free: Option<extern "C" fn(*mut git_config_entry)>,
836 pub payload: *mut c_void,
837 }
838
839 git_enum! {
840 pub enum git_config_level_t: c_int {
841 GIT_CONFIG_LEVEL_PROGRAMDATA = 1,
842 GIT_CONFIG_LEVEL_SYSTEM = 2,
843 GIT_CONFIG_LEVEL_XDG = 3,
844 GIT_CONFIG_LEVEL_GLOBAL = 4,
845 GIT_CONFIG_LEVEL_LOCAL = 5,
846 GIT_CONFIG_LEVEL_APP = 6,
847 GIT_CONFIG_HIGHEST_LEVEL = -1,
848 }
849 }
850
851 git_enum! {
852 pub enum git_submodule_update_t {
853 GIT_SUBMODULE_UPDATE_CHECKOUT = 1,
854 GIT_SUBMODULE_UPDATE_REBASE = 2,
855 GIT_SUBMODULE_UPDATE_MERGE = 3,
856 GIT_SUBMODULE_UPDATE_NONE = 4,
857 GIT_SUBMODULE_UPDATE_DEFAULT = 0,
858 }
859 }
860
861 git_enum! {
862 pub enum git_submodule_ignore_t: c_int {
863 GIT_SUBMODULE_IGNORE_UNSPECIFIED = -1,
864
865 GIT_SUBMODULE_IGNORE_NONE = 1,
866 GIT_SUBMODULE_IGNORE_UNTRACKED = 2,
867 GIT_SUBMODULE_IGNORE_DIRTY = 3,
868 GIT_SUBMODULE_IGNORE_ALL = 4,
869 }
870 }
871
872 pub type git_submodule_cb =
873 Option<extern "C" fn(*mut git_submodule, *const c_char, *mut c_void) -> c_int>;
874
875 #[repr(C)]
876 pub struct git_submodule_update_options {
877 pub version: c_uint,
878 pub checkout_opts: git_checkout_options,
879 pub fetch_opts: git_fetch_options,
880 pub allow_fetch: c_int,
881 }
882
883 #[repr(C)]
884 pub struct git_writestream {
885 pub write: Option<extern "C" fn(*mut git_writestream, *const c_char, size_t) -> c_int>,
886 pub close: Option<extern "C" fn(*mut git_writestream) -> c_int>,
887 pub free: Option<extern "C" fn(*mut git_writestream)>,
888 }
889
890 git_enum! {
891 pub enum git_attr_value_t {
892 GIT_ATTR_VALUE_UNSPECIFIED = 0,
893 GIT_ATTR_VALUE_TRUE,
894 GIT_ATTR_VALUE_FALSE,
895 GIT_ATTR_VALUE_STRING,
896 }
897 }
898
899 pub const GIT_ATTR_CHECK_FILE_THEN_INDEX: u32 = 0;
900 pub const GIT_ATTR_CHECK_INDEX_THEN_FILE: u32 = 1;
901 pub const GIT_ATTR_CHECK_INDEX_ONLY: u32 = 2;
902 pub const GIT_ATTR_CHECK_NO_SYSTEM: u32 = 1 << 2;
903 pub const GIT_ATTR_CHECK_INCLUDE_HEAD: u32 = 1 << 3;
904
905 #[repr(C)]
906 pub struct git_cred {
907 pub credtype: git_credtype_t,
908 pub free: Option<extern "C" fn(*mut git_cred)>,
909 }
910
911 git_enum! {
912 pub enum git_credtype_t {
913 GIT_CREDTYPE_USERPASS_PLAINTEXT = 1 << 0,
914 GIT_CREDTYPE_SSH_KEY = 1 << 1,
915 GIT_CREDTYPE_SSH_CUSTOM = 1 << 2,
916 GIT_CREDTYPE_DEFAULT = 1 << 3,
917 GIT_CREDTYPE_SSH_INTERACTIVE = 1 << 4,
918 GIT_CREDTYPE_USERNAME = 1 << 5,
919 GIT_CREDTYPE_SSH_MEMORY = 1 << 6,
920 }
921 }
922
923 pub type git_cred_ssh_interactive_callback = Option<
924 extern "C" fn(
925 name: *const c_char,
926 name_len: c_int,
927 instruction: *const c_char,
928 instruction_len: c_int,
929 num_prompts: c_int,
930 prompts: *const LIBSSH2_USERAUTH_KBDINT_PROMPT,
931 responses: *mut LIBSSH2_USERAUTH_KBDINT_RESPONSE,
932 abstrakt: *mut *mut c_void,
933 ),
934 >;
935
936 pub type git_cred_sign_callback = Option<
937 extern "C" fn(
938 session: *mut LIBSSH2_SESSION,
939 sig: *mut *mut c_uchar,
940 sig_len: *mut size_t,
941 data: *const c_uchar,
942 data_len: size_t,
943 abstrakt: *mut *mut c_void,
944 ),
945 >;
946
947 pub enum LIBSSH2_SESSION {}
948 pub enum LIBSSH2_USERAUTH_KBDINT_PROMPT {}
949 pub enum LIBSSH2_USERAUTH_KBDINT_RESPONSE {}
950
951 #[repr(C)]
952 pub struct git_push_options {
953 pub version: c_uint,
954 pub pb_parallelism: c_uint,
955 pub callbacks: git_remote_callbacks,
956 pub proxy_opts: git_proxy_options,
957 pub follow_redirects: git_remote_redirect_t,
958 pub custom_headers: git_strarray,
959 }
960
961 pub type git_tag_foreach_cb =
962 Option<extern "C" fn(name: *const c_char, oid: *mut git_oid, payload: *mut c_void) -> c_int>;
963
964 git_enum! {
965 pub enum git_index_add_option_t {
966 GIT_INDEX_ADD_DEFAULT = 0,
967 GIT_INDEX_ADD_FORCE = 1 << 0,
968 GIT_INDEX_ADD_DISABLE_PATHSPEC_MATCH = 1 << 1,
969 GIT_INDEX_ADD_CHECK_PATHSPEC = 1 << 2,
970 }
971 }
972
973 git_enum! {
974 pub enum git_repository_open_flag_t {
975 GIT_REPOSITORY_OPEN_NO_SEARCH = 1 << 0,
976 GIT_REPOSITORY_OPEN_CROSS_FS = 1 << 1,
977 GIT_REPOSITORY_OPEN_BARE = 1 << 2,
978 GIT_REPOSITORY_OPEN_NO_DOTGIT = 1 << 3,
979 GIT_REPOSITORY_OPEN_FROM_ENV = 1 << 4,
980 }
981 }
982
983 #[repr(C)]
984 pub struct git_repository_init_options {
985 pub version: c_uint,
986 pub flags: u32,
987 pub mode: u32,
988 pub workdir_path: *const c_char,
989 pub description: *const c_char,
990 pub template_path: *const c_char,
991 pub initial_head: *const c_char,
992 pub origin_url: *const c_char,
993 }
994
995 pub const GIT_REPOSITORY_INIT_OPTIONS_VERSION: c_uint = 1;
996
997 git_enum! {
998 pub enum git_repository_init_flag_t {
999 GIT_REPOSITORY_INIT_BARE = 1 << 0,
1000 GIT_REPOSITORY_INIT_NO_REINIT = 1 << 1,
1001 GIT_REPOSITORY_INIT_NO_DOTGIT_DIR = 1 << 2,
1002 GIT_REPOSITORY_INIT_MKDIR = 1 << 3,
1003 GIT_REPOSITORY_INIT_MKPATH = 1 << 4,
1004 GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE = 1 << 5,
1005 }
1006 }
1007
1008 git_enum! {
1009 pub enum git_repository_init_mode_t {
1010 GIT_REPOSITORY_INIT_SHARED_UMASK = 0,
1011 GIT_REPOSITORY_INIT_SHARED_GROUP = 0o002775,
1012 GIT_REPOSITORY_INIT_SHARED_ALL = 0o002777,
1013 }
1014 }
1015
1016 git_enum! {
1017 pub enum git_sort_t {
1018 GIT_SORT_NONE = 0,
1019 GIT_SORT_TOPOLOGICAL = 1 << 0,
1020 GIT_SORT_TIME = 1 << 1,
1021 GIT_SORT_REVERSE = 1 << 2,
1022 }
1023 }
1024
1025 git_enum! {
1026 pub enum git_submodule_status_t {
1027 GIT_SUBMODULE_STATUS_IN_HEAD = 1 << 0,
1028 GIT_SUBMODULE_STATUS_IN_INDEX = 1 << 1,
1029 GIT_SUBMODULE_STATUS_IN_CONFIG = 1 << 2,
1030 GIT_SUBMODULE_STATUS_IN_WD = 1 << 3,
1031 GIT_SUBMODULE_STATUS_INDEX_ADDED = 1 << 4,
1032 GIT_SUBMODULE_STATUS_INDEX_DELETED = 1 << 5,
1033 GIT_SUBMODULE_STATUS_INDEX_MODIFIED = 1 << 6,
1034 GIT_SUBMODULE_STATUS_WD_UNINITIALIZED = 1 << 7,
1035 GIT_SUBMODULE_STATUS_WD_ADDED = 1 << 8,
1036 GIT_SUBMODULE_STATUS_WD_DELETED = 1 << 9,
1037 GIT_SUBMODULE_STATUS_WD_MODIFIED = 1 << 10,
1038 GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED = 1 << 11,
1039 GIT_SUBMODULE_STATUS_WD_WD_MODIFIED = 1 << 12,
1040 GIT_SUBMODULE_STATUS_WD_UNTRACKED = 1 << 13,
1041 }
1042 }
1043
1044 #[repr(C)]
1045 pub struct git_remote_head {
1046 pub local: c_int,
1047 pub oid: git_oid,
1048 pub loid: git_oid,
1049 pub name: *mut c_char,
1050 pub symref_target: *mut c_char,
1051 }
1052
1053 git_enum! {
1054 pub enum git_pathspec_flag_t {
1055 GIT_PATHSPEC_DEFAULT = 0,
1056 GIT_PATHSPEC_IGNORE_CASE = 1 << 0,
1057 GIT_PATHSPEC_USE_CASE = 1 << 1,
1058 GIT_PATHSPEC_NO_GLOB = 1 << 2,
1059 GIT_PATHSPEC_NO_MATCH_ERROR = 1 << 3,
1060 GIT_PATHSPEC_FIND_FAILURES = 1 << 4,
1061 GIT_PATHSPEC_FAILURES_ONLY = 1 << 5,
1062 }
1063 }
1064
1065 pub type git_diff_file_cb = Option<extern "C" fn(*const git_diff_delta, f32, *mut c_void) -> c_int>;
1066 pub type git_diff_hunk_cb =
1067 Option<extern "C" fn(*const git_diff_delta, *const git_diff_hunk, *mut c_void) -> c_int>;
1068 pub type git_diff_line_cb = Option<
1069 extern "C" fn(
1070 *const git_diff_delta,
1071 *const git_diff_hunk,
1072 *const git_diff_line,
1073 *mut c_void,
1074 ) -> c_int,
1075 >;
1076 pub type git_diff_binary_cb =
1077 Option<extern "C" fn(*const git_diff_delta, *const git_diff_binary, *mut c_void) -> c_int>;
1078
1079 #[repr(C)]
1080 pub struct git_diff_hunk {
1081 pub old_start: c_int,
1082 pub old_lines: c_int,
1083 pub new_start: c_int,
1084 pub new_lines: c_int,
1085 pub header_len: size_t,
1086 pub header: [c_char; 128],
1087 }
1088
1089 git_enum! {
1090 pub enum git_diff_line_t {
1091 GIT_DIFF_LINE_CONTEXT = b' ' as git_diff_line_t,
1092 GIT_DIFF_LINE_ADDITION = b'+' as git_diff_line_t,
1093 GIT_DIFF_LINE_DELETION = b'-' as git_diff_line_t,
1094 GIT_DIFF_LINE_CONTEXT_EOFNL = b'=' as git_diff_line_t,
1095 GIT_DIFF_LINE_ADD_EOFNL = b'>' as git_diff_line_t,
1096 GIT_DIFF_LINE_DEL_EOFNL = b'<' as git_diff_line_t,
1097 GIT_DIFF_LINE_FILE_HDR = b'F' as git_diff_line_t,
1098 GIT_DIFF_LINE_HUNK_HDR = b'H' as git_diff_line_t,
1099 GIT_DIFF_LINE_BINARY = b'B' as git_diff_line_t,
1100 }
1101 }
1102
1103 #[repr(C)]
1104 pub struct git_diff_line {
1105 pub origin: c_char,
1106 pub old_lineno: c_int,
1107 pub new_lineno: c_int,
1108 pub num_lines: c_int,
1109 pub content_len: size_t,
1110 pub content_offset: git_off_t,
1111 pub content: *const c_char,
1112 }
1113
1114 #[repr(C)]
1115 pub struct git_diff_options {
1116 pub version: c_uint,
1117 pub flags: u32,
1118 pub ignore_submodules: git_submodule_ignore_t,
1119 pub pathspec: git_strarray,
1120 pub notify_cb: git_diff_notify_cb,
1121 pub progress_cb: git_diff_progress_cb,
1122 pub payload: *mut c_void,
1123 pub context_lines: u32,
1124 pub interhunk_lines: u32,
1125 pub id_abbrev: u16,
1126 pub max_size: git_off_t,
1127 pub old_prefix: *const c_char,
1128 pub new_prefix: *const c_char,
1129 }
1130
1131 git_enum! {
1132 pub enum git_diff_format_t {
1133 GIT_DIFF_FORMAT_PATCH = 1,
1134 GIT_DIFF_FORMAT_PATCH_HEADER = 2,
1135 GIT_DIFF_FORMAT_RAW = 3,
1136 GIT_DIFF_FORMAT_NAME_ONLY = 4,
1137 GIT_DIFF_FORMAT_NAME_STATUS = 5,
1138 GIT_DIFF_FORMAT_PATCH_ID = 6,
1139 }
1140 }
1141
1142 git_enum! {
1143 pub enum git_diff_stats_format_t {
1144 GIT_DIFF_STATS_NONE = 0,
1145 GIT_DIFF_STATS_FULL = 1 << 0,
1146 GIT_DIFF_STATS_SHORT = 1 << 1,
1147 GIT_DIFF_STATS_NUMBER = 1 << 2,
1148 GIT_DIFF_STATS_INCLUDE_SUMMARY = 1 << 3,
1149 }
1150 }
1151
1152 pub type git_diff_notify_cb = Option<
1153 extern "C" fn(*const git_diff, *const git_diff_delta, *const c_char, *mut c_void) -> c_int,
1154 >;
1155
1156 pub type git_diff_progress_cb =
1157 Option<extern "C" fn(*const git_diff, *const c_char, *const c_char, *mut c_void) -> c_int>;
1158
1159 pub type git_diff_option_t = i32;
1160 pub const GIT_DIFF_NORMAL: git_diff_option_t = 0;
1161 pub const GIT_DIFF_REVERSE: git_diff_option_t = 1 << 0;
1162 pub const GIT_DIFF_INCLUDE_IGNORED: git_diff_option_t = 1 << 1;
1163 pub const GIT_DIFF_RECURSE_IGNORED_DIRS: git_diff_option_t = 1 << 2;
1164 pub const GIT_DIFF_INCLUDE_UNTRACKED: git_diff_option_t = 1 << 3;
1165 pub const GIT_DIFF_RECURSE_UNTRACKED_DIRS: git_diff_option_t = 1 << 4;
1166 pub const GIT_DIFF_INCLUDE_UNMODIFIED: git_diff_option_t = 1 << 5;
1167 pub const GIT_DIFF_INCLUDE_TYPECHANGE: git_diff_option_t = 1 << 6;
1168 pub const GIT_DIFF_INCLUDE_TYPECHANGE_TREES: git_diff_option_t = 1 << 7;
1169 pub const GIT_DIFF_IGNORE_FILEMODE: git_diff_option_t = 1 << 8;
1170 pub const GIT_DIFF_IGNORE_SUBMODULES: git_diff_option_t = 1 << 9;
1171 pub const GIT_DIFF_IGNORE_CASE: git_diff_option_t = 1 << 10;
1172 pub const GIT_DIFF_DISABLE_PATHSPEC_MATCH: git_diff_option_t = 1 << 12;
1173 pub const GIT_DIFF_SKIP_BINARY_CHECK: git_diff_option_t = 1 << 13;
1174 pub const GIT_DIFF_ENABLE_FAST_UNTRACKED_DIRS: git_diff_option_t = 1 << 14;
1175 pub const GIT_DIFF_UPDATE_INDEX: git_diff_option_t = 1 << 15;
1176 pub const GIT_DIFF_INCLUDE_UNREADABLE: git_diff_option_t = 1 << 16;
1177 pub const GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED: git_diff_option_t = 1 << 17;
1178 pub const GIT_DIFF_INDENT_HEURISTIC: git_diff_option_t = 1 << 18;
1179 pub const GIT_DIFF_IGNORE_BLANK_LINES: git_diff_option_t = 1 << 19;
1180 pub const GIT_DIFF_FORCE_TEXT: git_diff_option_t = 1 << 20;
1181 pub const GIT_DIFF_FORCE_BINARY: git_diff_option_t = 1 << 21;
1182 pub const GIT_DIFF_IGNORE_WHITESPACE: git_diff_option_t = 1 << 22;
1183 pub const GIT_DIFF_IGNORE_WHITESPACE_CHANGE: git_diff_option_t = 1 << 23;
1184 pub const GIT_DIFF_IGNORE_WHITESPACE_EOL: git_diff_option_t = 1 << 24;
1185 pub const GIT_DIFF_SHOW_UNTRACKED_CONTENT: git_diff_option_t = 1 << 25;
1186 pub const GIT_DIFF_SHOW_UNMODIFIED: git_diff_option_t = 1 << 26;
1187 pub const GIT_DIFF_PATIENCE: git_diff_option_t = 1 << 28;
1188 pub const GIT_DIFF_MINIMAL: git_diff_option_t = 1 << 29;
1189 pub const GIT_DIFF_SHOW_BINARY: git_diff_option_t = 1 << 30;
1190
1191 #[repr(C)]
1192 pub struct git_diff_find_options {
1193 pub version: c_uint,
1194 pub flags: u32,
1195 pub rename_threshold: u16,
1196 pub rename_from_rewrite_threshold: u16,
1197 pub copy_threshold: u16,
1198 pub break_rewrite_threshold: u16,
1199 pub rename_limit: size_t,
1200 pub metric: *mut git_diff_similarity_metric,
1201 }
1202
1203 #[repr(C)]
1204 pub struct git_diff_similarity_metric {
1205 pub file_signature: Option<
1206 extern "C" fn(*mut *mut c_void, *const git_diff_file, *const c_char, *mut c_void) -> c_int,
1207 >,
1208 pub buffer_signature: Option<
1209 extern "C" fn(
1210 *mut *mut c_void,
1211 *const git_diff_file,
1212 *const c_char,
1213 size_t,
1214 *mut c_void,
1215 ) -> c_int,
1216 >,
1217 pub free_signature: Option<extern "C" fn(*mut c_void, *mut c_void)>,
1218 pub similarity:
1219 Option<extern "C" fn(*mut c_int, *mut c_void, *mut c_void, *mut c_void) -> c_int>,
1220 pub payload: *mut c_void,
1221 }
1222
1223 pub const GIT_DIFF_FIND_OPTIONS_VERSION: c_uint = 1;
1224
1225 pub const GIT_DIFF_FIND_BY_CONFIG: u32 = 0;
1226 pub const GIT_DIFF_FIND_RENAMES: u32 = 1 << 0;
1227 pub const GIT_DIFF_FIND_RENAMES_FROM_REWRITES: u32 = 1 << 1;
1228 pub const GIT_DIFF_FIND_COPIES: u32 = 1 << 2;
1229 pub const GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED: u32 = 1 << 3;
1230 pub const GIT_DIFF_FIND_REWRITES: u32 = 1 << 4;
1231 pub const GIT_DIFF_BREAK_REWRITES: u32 = 1 << 5;
1232 pub const GIT_DIFF_FIND_AND_BREAK_REWRITES: u32 = GIT_DIFF_FIND_REWRITES | GIT_DIFF_BREAK_REWRITES;
1233 pub const GIT_DIFF_FIND_FOR_UNTRACKED: u32 = 1 << 6;
1234 pub const GIT_DIFF_FIND_ALL: u32 = 0x0ff;
1235 pub const GIT_DIFF_FIND_IGNORE_LEADING_WHITESPACE: u32 = 0;
1236 pub const GIT_DIFF_FIND_IGNORE_WHITESPACE: u32 = 1 << 12;
1237 pub const GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE: u32 = 1 << 13;
1238 pub const GIT_DIFF_FIND_EXACT_MATCH_ONLY: u32 = 1 << 14;
1239 pub const GIT_DIFF_BREAK_REWRITES_FOR_RENAMES_ONLY: u32 = 1 << 15;
1240 pub const GIT_DIFF_FIND_REMOVE_UNMODIFIED: u32 = 1 << 16;
1241
1242 #[repr(C)]
1243 pub struct git_diff_format_email_options {
1244 pub version: c_uint,
1245 pub flags: u32,
1246 pub patch_no: usize,
1247 pub total_patches: usize,
1248 pub id: *const git_oid,
1249 pub summary: *const c_char,
1250 pub body: *const c_char,
1251 pub author: *const git_signature,
1252 }
1253
1254 pub const GIT_DIFF_FORMAT_EMAIL_OPTIONS_VERSION: c_uint = 1;
1255
1256 pub const GIT_DIFF_FORMAT_EMAIL_NONE: u32 = 0;
1257 pub const GIT_DIFF_FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER: u32 = 1 << 0;
1258
1259 #[repr(C)]
1260 pub struct git_diff_patchid_options {
1261 pub version: c_uint,
1262 }
1263
1264 pub const GIT_DIFF_PATCHID_OPTIONS_VERSION: c_uint = 1;
1265
1266 #[repr(C)]
1267 pub struct git_diff_binary {
1268 pub contains_data: c_uint,
1269 pub old_file: git_diff_binary_file,
1270 pub new_file: git_diff_binary_file,
1271 }
1272
1273 #[repr(C)]
1274 pub struct git_diff_binary_file {
1275 pub kind: git_diff_binary_t,
1276 pub data: *const c_char,
1277 pub datalen: size_t,
1278 pub inflatedlen: size_t,
1279 }
1280
1281 git_enum! {
1282 pub enum git_diff_binary_t {
1283 GIT_DIFF_BINARY_NONE,
1284 GIT_DIFF_BINARY_LITERAL,
1285 GIT_DIFF_BINARY_DELTA,
1286 }
1287 }
1288
1289 #[repr(C)]
1290 pub struct git_merge_options {
1291 pub version: c_uint,
1292 pub flags: u32,
1293 pub rename_threshold: c_uint,
1294 pub target_limit: c_uint,
1295 pub metric: *mut git_diff_similarity_metric,
1296 pub recursion_limit: c_uint,
1297 pub default_driver: *const c_char,
1298 pub file_favor: git_merge_file_favor_t,
1299 pub file_flags: u32,
1300 }
1301
1302 git_enum! {
1303 pub enum git_merge_flag_t {
1304 GIT_MERGE_FIND_RENAMES = 1 << 0,
1305 GIT_MERGE_FAIL_ON_CONFLICT = 1 << 1,
1306 GIT_MERGE_SKIP_REUC = 1 << 2,
1307 GIT_MERGE_NO_RECURSIVE = 1 << 3,
1308 }
1309 }
1310
1311 git_enum! {
1312 pub enum git_merge_file_favor_t {
1313 GIT_MERGE_FILE_FAVOR_NORMAL = 0,
1314 GIT_MERGE_FILE_FAVOR_OURS = 1,
1315 GIT_MERGE_FILE_FAVOR_THEIRS = 2,
1316 GIT_MERGE_FILE_FAVOR_UNION = 3,
1317 }
1318 }
1319
1320 git_enum! {
1321 pub enum git_merge_file_flag_t {
1322 GIT_MERGE_FILE_DEFAULT = 0,
1323 GIT_MERGE_FILE_STYLE_MERGE = 1 << 0,
1324 GIT_MERGE_FILE_STYLE_DIFF3 = 1 << 1,
1325 GIT_MERGE_FILE_SIMPLIFY_ALNUM = 1 << 2,
1326 GIT_MERGE_FILE_IGNORE_WHITESPACE = 1 << 3,
1327 GIT_MERGE_FILE_IGNORE_WHITESPACE_CHANGE = 1 << 4,
1328 GIT_MERGE_FILE_IGNORE_WHITESPACE_EOL = 1 << 5,
1329 GIT_MERGE_FILE_DIFF_PATIENCE = 1 << 6,
1330 GIT_MERGE_FILE_DIFF_MINIMAL = 1 << 7,
1331 }
1332 }
1333
1334 git_enum! {
1335 pub enum git_merge_analysis_t {
1336 GIT_MERGE_ANALYSIS_NONE = 0,
1337 GIT_MERGE_ANALYSIS_NORMAL = 1 << 0,
1338 GIT_MERGE_ANALYSIS_UP_TO_DATE = 1 << 1,
1339 GIT_MERGE_ANALYSIS_FASTFORWARD = 1 << 2,
1340 GIT_MERGE_ANALYSIS_UNBORN = 1 << 3,
1341 }
1342 }
1343
1344 git_enum! {
1345 pub enum git_merge_preference_t {
1346 GIT_MERGE_PREFERENCE_NONE = 0,
1347 GIT_MERGE_PREFERENCE_NO_FASTFORWARD = 1 << 0,
1348 GIT_MERGE_PREFERENCE_FASTFORWARD_ONLY = 1 << 1,
1349 }
1350 }
1351
1352 pub type git_transport_cb = Option<
1353 extern "C" fn(
1354 out: *mut *mut git_transport,
1355 owner: *mut git_remote,
1356 param: *mut c_void,
1357 ) -> c_int,
1358 >;
1359
1360 #[repr(C)]
1361 pub struct git_transport {
1362 pub version: c_uint,
1363 pub connect: Option<
1364 extern "C" fn(
1365 transport: *mut git_transport,
1366 url: *const c_char,
1367 direction: c_int,
1368 connect_opts: *const git_remote_connect_options,
1369 ) -> c_int,
1370 >,
1371 pub set_connect_opts: Option<
1372 extern "C" fn(
1373 transport: *mut git_transport,
1374 connect_opts: *const git_remote_connect_options,
1375 ) -> c_int,
1376 >,
1377 pub capabilities:
1378 Option<extern "C" fn(capabilities: *mut c_uint, transport: *mut git_transport) -> c_int>,
1379 pub ls: Option<
1380 extern "C" fn(
1381 out: *mut *mut *const git_remote_head,
1382 size: *mut size_t,
1383 transport: *mut git_transport,
1384 ) -> c_int,
1385 >,
1386 pub push: Option<extern "C" fn(transport: *mut git_transport, push: *mut git_push) -> c_int>,
1387 pub negotiate_fetch: Option<
1388 extern "C" fn(
1389 transport: *mut git_transport,
1390 repo: *mut git_repository,
1391 refs: *const *const git_remote_head,
1392 count: size_t,
1393 ) -> c_int,
1394 >,
1395 pub download_pack: Option<
1396 extern "C" fn(
1397 transport: *mut git_transport,
1398 repo: *mut git_repository,
1399 stats: *mut git_indexer_progress,
1400 ) -> c_int,
1401 >,
1402 pub is_connected: Option<extern "C" fn(transport: *mut git_transport) -> c_int>,
1403 pub cancel: Option<extern "C" fn(transport: *mut git_transport)>,
1404 pub close: Option<extern "C" fn(transport: *mut git_transport) -> c_int>,
1405 pub free: Option<extern "C" fn(transport: *mut git_transport)>,
1406 }
1407
1408 #[repr(C)]
1409 pub struct git_remote_connect_options {
1410 pub version: c_uint,
1411 pub callbacks: git_remote_callbacks,
1412 pub proxy_opts: git_proxy_options,
1413 pub follow_redirects: git_remote_redirect_t,
1414 pub custom_headers: git_strarray,
1415 }
1416
1417 git_enum! {
1418 pub enum git_remote_redirect_t {
1419 GIT_REMOTE_REDIRECT_NONE = 1 << 0,
1420 GIT_REMOTE_REDIRECT_INITIAL = 1 << 1,
1421 GIT_REMOTE_REDIRECT_ALL = 1 << 2,
1422 }
1423 }
1424
1425 #[repr(C)]
1426 pub struct git_odb_backend {
1427 pub version: c_uint,
1428 pub odb: *mut git_odb,
1429 pub read: Option<
1430 extern "C" fn(
1431 *mut *mut c_void,
1432 *mut size_t,
1433 *mut git_object_t,
1434 *mut git_odb_backend,
1435 *const git_oid,
1436 ) -> c_int,
1437 >,
1438
1439 pub read_prefix: Option<
1440 extern "C" fn(
1441 *mut git_oid,
1442 *mut *mut c_void,
1443 *mut size_t,
1444 *mut git_object_t,
1445 *mut git_odb_backend,
1446 *const git_oid,
1447 size_t,
1448 ) -> c_int,
1449 >,
1450 pub read_header: Option<
1451 extern "C" fn(
1452 *mut size_t,
1453 *mut git_object_t,
1454 *mut git_odb_backend,
1455 *const git_oid,
1456 ) -> c_int,
1457 >,
1458
1459 pub write: Option<
1460 extern "C" fn(
1461 *mut git_odb_backend,
1462 *const git_oid,
1463 *const c_void,
1464 size_t,
1465 git_object_t,
1466 ) -> c_int,
1467 >,
1468
1469 pub writestream: Option<
1470 extern "C" fn(
1471 *mut *mut git_odb_stream,
1472 *mut git_odb_backend,
1473 git_object_size_t,
1474 git_object_t,
1475 ) -> c_int,
1476 >,
1477
1478 pub readstream: Option<
1479 extern "C" fn(
1480 *mut *mut git_odb_stream,
1481 *mut size_t,
1482 *mut git_object_t,
1483 *mut git_odb_backend,
1484 *const git_oid,
1485 ) -> c_int,
1486 >,
1487
1488 pub exists: Option<extern "C" fn(*mut git_odb_backend, *const git_oid) -> c_int>,
1489
1490 pub exists_prefix:
1491 Option<extern "C" fn(*mut git_oid, *mut git_odb_backend, *const git_oid, size_t) -> c_int>,
1492
1493 pub refresh: Option<extern "C" fn(*mut git_odb_backend) -> c_int>,
1494
1495 pub foreach:
1496 Option<extern "C" fn(*mut git_odb_backend, git_odb_foreach_cb, *mut c_void) -> c_int>,
1497
1498 pub writepack: Option<
1499 extern "C" fn(
1500 *mut *mut git_odb_writepack,
1501 *mut git_odb_backend,
1502 *mut git_odb,
1503 git_indexer_progress_cb,
1504 *mut c_void,
1505 ) -> c_int,
1506 >,
1507
1508 pub writemidx: Option<extern "C" fn(*mut git_odb_backend) -> c_int>,
1509
1510 pub freshen: Option<extern "C" fn(*mut git_odb_backend, *const git_oid) -> c_int>,
1511
1512 pub free: Option<extern "C" fn(*mut git_odb_backend)>,
1513 }
1514
1515 git_enum! {
1516 pub enum git_odb_lookup_flags_t {
1517 GIT_ODB_LOOKUP_NO_REFRESH = 1 << 0,
1518 }
1519 }
1520
1521 #[repr(C)]
1522 pub struct git_odb_writepack {
1523 pub backend: *mut git_odb_backend,
1524
1525 pub append: Option<
1526 extern "C" fn(
1527 *mut git_odb_writepack,
1528 *const c_void,
1529 size_t,
1530 *mut git_indexer_progress,
1531 ) -> c_int,
1532 >,
1533
1534 pub commit:
1535 Option<unsafe extern "C" fn(*mut git_odb_writepack, *mut git_indexer_progress) -> c_int>,
1536
1537 pub free: Option<unsafe extern "C" fn(*mut git_odb_writepack)>,
1538 }
1539
1540 #[repr(C)]
1541 pub struct git_refdb_backend {
1542 pub version: c_uint,
1543 pub exists: Option<extern "C" fn(*mut c_int, *mut git_refdb_backend, *const c_char) -> c_int>,
1544 pub lookup: Option<
1545 extern "C" fn(*mut *mut git_reference, *mut git_refdb_backend, *const c_char) -> c_int,
1546 >,
1547 pub iterator: Option<
1548 extern "C" fn(
1549 *mut *mut git_reference_iterator,
1550 *mut git_refdb_backend,
1551 *const c_char,
1552 ) -> c_int,
1553 >,
1554 pub write: Option<
1555 extern "C" fn(
1556 *mut git_refdb_backend,
1557 *const git_reference,
1558 c_int,
1559 *const git_signature,
1560 *const c_char,
1561 *const git_oid,
1562 *const c_char,
1563 ) -> c_int,
1564 >,
1565 pub rename: Option<
1566 extern "C" fn(
1567 *mut *mut git_reference,
1568 *mut git_refdb_backend,
1569 *const c_char,
1570 *const c_char,
1571 c_int,
1572 *const git_signature,
1573 *const c_char,
1574 ) -> c_int,
1575 >,
1576 pub del: Option<
1577 extern "C" fn(
1578 *mut git_refdb_backend,
1579 *const c_char,
1580 *const git_oid,
1581 *const c_char,
1582 ) -> c_int,
1583 >,
1584 pub compress: Option<extern "C" fn(*mut git_refdb_backend) -> c_int>,
1585 pub has_log: Option<extern "C" fn(*mut git_refdb_backend, *const c_char) -> c_int>,
1586 pub ensure_log: Option<extern "C" fn(*mut git_refdb_backend, *const c_char) -> c_int>,
1587 pub free: Option<extern "C" fn(*mut git_refdb_backend)>,
1588 pub reflog_read:
1589 Option<extern "C" fn(*mut *mut git_reflog, *mut git_refdb_backend, *const c_char) -> c_int>,
1590 pub reflog_write: Option<extern "C" fn(*mut git_refdb_backend, *mut git_reflog) -> c_int>,
1591 pub reflog_rename:
1592 Option<extern "C" fn(*mut git_refdb_backend, *const c_char, *const c_char) -> c_int>,
1593 pub reflog_delete: Option<extern "C" fn(*mut git_refdb_backend, *const c_char) -> c_int>,
1594 pub lock:
1595 Option<extern "C" fn(*mut *mut c_void, *mut git_refdb_backend, *const c_char) -> c_int>,
1596 pub unlock: Option<
1597 extern "C" fn(
1598 *mut git_refdb_backend,
1599 *mut c_void,
1600 c_int,
1601 c_int,
1602 *const git_reference,
1603 *const git_signature,
1604 *const c_char,
1605 ) -> c_int,
1606 >,
1607 }
1608
1609 #[repr(C)]
1610 pub struct git_proxy_options {
1611 pub version: c_uint,
1612 pub kind: git_proxy_t,
1613 pub url: *const c_char,
1614 pub credentials: git_cred_acquire_cb,
1615 pub certificate_check: git_transport_certificate_check_cb,
1616 pub payload: *mut c_void,
1617 }
1618
1619 git_enum! {
1620 pub enum git_proxy_t {
1621 GIT_PROXY_NONE = 0,
1622 GIT_PROXY_AUTO = 1,
1623 GIT_PROXY_SPECIFIED = 2,
1624 }
1625 }
1626
1627 git_enum! {
1628 pub enum git_smart_service_t {
1629 GIT_SERVICE_UPLOADPACK_LS = 1,
1630 GIT_SERVICE_UPLOADPACK = 2,
1631 GIT_SERVICE_RECEIVEPACK_LS = 3,
1632 GIT_SERVICE_RECEIVEPACK = 4,
1633 }
1634 }
1635
1636 #[repr(C)]
1637 pub struct git_smart_subtransport_stream {
1638 pub subtransport: *mut git_smart_subtransport,
1639 pub read: Option<
1640 extern "C" fn(
1641 *mut git_smart_subtransport_stream,
1642 *mut c_char,
1643 size_t,
1644 *mut size_t,
1645 ) -> c_int,
1646 >,
1647 pub write:
1648 Option<extern "C" fn(*mut git_smart_subtransport_stream, *const c_char, size_t) -> c_int>,
1649 pub free: Option<extern "C" fn(*mut git_smart_subtransport_stream)>,
1650 }
1651
1652 #[repr(C)]
1653 pub struct git_smart_subtransport {
1654 pub action: Option<
1655 extern "C" fn(
1656 *mut *mut git_smart_subtransport_stream,
1657 *mut git_smart_subtransport,
1658 *const c_char,
1659 git_smart_service_t,
1660 ) -> c_int,
1661 >,
1662 pub close: Option<extern "C" fn(*mut git_smart_subtransport) -> c_int>,
1663 pub free: Option<extern "C" fn(*mut git_smart_subtransport)>,
1664 }
1665
1666 pub type git_smart_subtransport_cb = Option<
1667 extern "C" fn(*mut *mut git_smart_subtransport, *mut git_transport, *mut c_void) -> c_int,
1668 >;
1669
1670 #[repr(C)]
1671 pub struct git_smart_subtransport_definition {
1672 pub callback: git_smart_subtransport_cb,
1673 pub rpc: c_uint,
1674 pub param: *mut c_void,
1675 }
1676
1677 #[repr(C)]
1678 pub struct git_describe_options {
1679 pub version: c_uint,
1680 pub max_candidates_tags: c_uint,
1681 pub describe_strategy: c_uint,
1682 pub pattern: *const c_char,
1683 pub only_follow_first_parent: c_int,
1684 pub show_commit_oid_as_fallback: c_int,
1685 }
1686
1687 git_enum! {
1688 pub enum git_describe_strategy_t {
1689 GIT_DESCRIBE_DEFAULT,
1690 GIT_DESCRIBE_TAGS,
1691 GIT_DESCRIBE_ALL,
1692 }
1693 }
1694
1695 #[repr(C)]
1696 pub struct git_describe_format_options {
1697 pub version: c_uint,
1698 pub abbreviated_size: c_uint,
1699 pub always_use_long_format: c_int,
1700 pub dirty_suffix: *const c_char,
1701 }
1702
1703 git_enum! {
1704 pub enum git_packbuilder_stage_t {
1705 GIT_PACKBUILDER_ADDING_OBJECTS,
1706 GIT_PACKBUILDER_DELTAFICATION,
1707 }
1708 }
1709
1710 git_enum! {
1711 pub enum git_stash_flags {
1712 GIT_STASH_DEFAULT = 0,
1713 GIT_STASH_KEEP_INDEX = 1 << 0,
1714 GIT_STASH_INCLUDE_UNTRACKED = 1 << 1,
1715 GIT_STASH_INCLUDE_IGNORED = 1 << 2,
1716 }
1717 }
1718
1719 git_enum! {
1720 pub enum git_stash_apply_flags {
1721 GIT_STASH_APPLY_DEFAULT = 0,
1722 GIT_STASH_APPLY_REINSTATE_INDEX = 1 << 0,
1723 }
1724 }
1725
1726 git_enum! {
1727 pub enum git_stash_apply_progress_t {
1728 GIT_STASH_APPLY_PROGRESS_NONE = 0,
1729 GIT_STASH_APPLY_PROGRESS_LOADING_STASH,
1730 GIT_STASH_APPLY_PROGRESS_ANALYZE_INDEX,
1731 GIT_STASH_APPLY_PROGRESS_ANALYZE_MODIFIED,
1732 GIT_STASH_APPLY_PROGRESS_ANALYZE_UNTRACKED,
1733 GIT_STASH_APPLY_PROGRESS_CHECKOUT_UNTRACKED,
1734 GIT_STASH_APPLY_PROGRESS_CHECKOUT_MODIFIED,
1735 GIT_STASH_APPLY_PROGRESS_DONE,
1736 }
1737 }
1738
1739 #[repr(C)]
1740 pub struct git_stash_apply_options {
1741 pub version: c_uint,
1742 pub flags: u32,
1743 pub checkout_options: git_checkout_options,
1744 pub progress_cb: git_stash_apply_progress_cb,
1745 pub progress_payload: *mut c_void,
1746 }
1747
1748 pub type git_stash_apply_progress_cb =
1749 Option<extern "C" fn(progress: git_stash_apply_progress_t, payload: *mut c_void) -> c_int>;
1750
1751 pub type git_stash_cb = Option<
1752 extern "C" fn(
1753 index: size_t,
1754 message: *const c_char,
1755 stash_id: *const git_oid,
1756 payload: *mut c_void,
1757 ) -> c_int,
1758 >;
1759
1760 pub type git_packbuilder_foreach_cb =
1761 Option<extern "C" fn(*const c_void, size_t, *mut c_void) -> c_int>;
1762
1763 pub type git_odb_foreach_cb =
1764 Option<extern "C" fn(id: *const git_oid, payload: *mut c_void) -> c_int>;
1765
1766 pub type git_commit_signing_cb = Option<
1767 extern "C" fn(
1768 signature: *mut git_buf,
1769 signature_field: *mut git_buf,
1770 commit_content: *const c_char,
1771 payload: *mut c_void,
1772 ) -> c_int,
1773 >;
1774
1775 pub type git_commit_create_cb = Option<
1776 extern "C" fn(
1777 *mut git_oid,
1778 *const git_signature,
1779 *const git_signature,
1780 *const c_char,
1781 *const c_char,
1782 *const git_tree,
1783 usize,
1784 *const git_commit,
1785 *mut c_void,
1786 ) -> c_int,
1787 >;
1788
1789 pub const GIT_REBASE_NO_OPERATION: usize = usize::max_value();
1790
1791 #[repr(C)]
1792 pub struct git_rebase_options {
1793 pub version: c_uint,
1794 pub quiet: c_int,
1795 pub inmemory: c_int,
1796 pub rewrite_notes_ref: *const c_char,
1797 pub merge_options: git_merge_options,
1798 pub checkout_options: git_checkout_options,
1799 pub commit_create_cb: git_commit_create_cb,
1800 pub signing_cb: git_commit_signing_cb,
1801 pub payload: *mut c_void,
1802 }
1803
1804 git_enum! {
1805 pub enum git_rebase_operation_t {
1806 GIT_REBASE_OPERATION_PICK = 0,
1807 GIT_REBASE_OPERATION_REWORD,
1808 GIT_REBASE_OPERATION_EDIT,
1809 GIT_REBASE_OPERATION_SQUASH,
1810 GIT_REBASE_OPERATION_FIXUP,
1811 GIT_REBASE_OPERATION_EXEC,
1812 }
1813 }
1814
1815 #[repr(C)]
1816 pub struct git_rebase_operation {
1817 pub kind: git_rebase_operation_t,
1818 pub id: git_oid,
1819 pub exec: *const c_char,
1820 }
1821
1822 #[repr(C)]
1823 pub struct git_cherrypick_options {
1824 pub version: c_uint,
1825 pub mainline: c_uint,
1826 pub merge_opts: git_merge_options,
1827 pub checkout_opts: git_checkout_options,
1828 }
1829
1830 pub type git_revert_options = git_cherrypick_options;
1831
1832 pub type git_apply_delta_cb =
1833 Option<extern "C" fn(delta: *const git_diff_delta, payload: *mut c_void) -> c_int>;
1834
1835 pub type git_apply_hunk_cb =
1836 Option<extern "C" fn(hunk: *const git_diff_hunk, payload: *mut c_void) -> c_int>;
1837
1838 git_enum! {
1839 pub enum git_apply_flags_t {
1840 GIT_APPLY_CHECK = 1<<0,
1841 }
1842 }
1843
1844 #[repr(C)]
1845 pub struct git_apply_options {
1846 pub version: c_uint,
1847 pub delta_cb: git_apply_delta_cb,
1848 pub hunk_cb: git_apply_hunk_cb,
1849 pub payload: *mut c_void,
1850 pub flags: u32,
1851 }
1852
1853 git_enum! {
1854 pub enum git_apply_location_t {
1855 GIT_APPLY_LOCATION_WORKDIR = 0,
1856 GIT_APPLY_LOCATION_INDEX = 1,
1857 GIT_APPLY_LOCATION_BOTH = 2,
1858 }
1859 }
1860
1861 git_enum! {
1862 pub enum git_libgit2_opt_t {
1863 GIT_OPT_GET_MWINDOW_SIZE = 0,
1864 GIT_OPT_SET_MWINDOW_SIZE,
1865 GIT_OPT_GET_MWINDOW_MAPPED_LIMIT,
1866 GIT_OPT_SET_MWINDOW_MAPPED_LIMIT,
1867 GIT_OPT_GET_SEARCH_PATH,
1868 GIT_OPT_SET_SEARCH_PATH,
1869 GIT_OPT_SET_CACHE_OBJECT_LIMIT,
1870 GIT_OPT_SET_CACHE_MAX_SIZE,
1871 GIT_OPT_ENABLE_CACHING,
1872 GIT_OPT_GET_CACHED_MEMORY,
1873 GIT_OPT_GET_TEMPLATE_PATH,
1874 GIT_OPT_SET_TEMPLATE_PATH,
1875 GIT_OPT_SET_SSL_CERT_LOCATIONS,
1876 GIT_OPT_SET_USER_AGENT,
1877 GIT_OPT_ENABLE_STRICT_OBJECT_CREATION,
1878 GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION,
1879 GIT_OPT_SET_SSL_CIPHERS,
1880 GIT_OPT_GET_USER_AGENT,
1881 GIT_OPT_ENABLE_OFS_DELTA,
1882 GIT_OPT_ENABLE_FSYNC_GITDIR,
1883 GIT_OPT_GET_WINDOWS_SHAREMODE,
1884 GIT_OPT_SET_WINDOWS_SHAREMODE,
1885 GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION,
1886 GIT_OPT_SET_ALLOCATOR,
1887 GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY,
1888 GIT_OPT_GET_PACK_MAX_OBJECTS,
1889 GIT_OPT_SET_PACK_MAX_OBJECTS,
1890 GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS,
1891 GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE,
1892 GIT_OPT_GET_MWINDOW_FILE_LIMIT,
1893 GIT_OPT_SET_MWINDOW_FILE_LIMIT,
1894 GIT_OPT_SET_ODB_PACKED_PRIORITY,
1895 GIT_OPT_SET_ODB_LOOSE_PRIORITY,
1896 GIT_OPT_GET_EXTENSIONS,
1897 GIT_OPT_SET_EXTENSIONS,
1898 GIT_OPT_GET_OWNER_VALIDATION,
1899 GIT_OPT_SET_OWNER_VALIDATION,
1900 }
1901 }
1902
1903 git_enum! {
1904 pub enum git_reference_format_t {
1905 GIT_REFERENCE_FORMAT_NORMAL = 0,
1906 GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL = 1 << 0,
1907 GIT_REFERENCE_FORMAT_REFSPEC_PATTERN = 1 << 1,
1908 GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND = 1 << 2,
1909 }
1910 }
1911
1912 #[repr(C)]
1913 pub struct git_worktree_add_options {
1914 pub version: c_uint,
1915 pub lock: c_int,
1916 pub reference: *mut git_reference,
1917 pub checkout_options: git_checkout_options,
1918 }
1919
1920 pub const GIT_WORKTREE_ADD_OPTIONS_VERSION: c_uint = 1;
1921
1922 git_enum! {
1923 pub enum git_worktree_prune_t {
1924 /* Prune working tree even if working tree is valid */
1925 GIT_WORKTREE_PRUNE_VALID = 1 << 0,
1926 /* Prune working tree even if it is locked */
1927 GIT_WORKTREE_PRUNE_LOCKED = 1 << 1,
1928 /* Prune checked out working tree */
1929 GIT_WORKTREE_PRUNE_WORKING_TREE = 1 << 2,
1930 }
1931 }
1932
1933 #[repr(C)]
1934 pub struct git_worktree_prune_options {
1935 pub version: c_uint,
1936 pub flags: u32,
1937 }
1938
1939 pub const GIT_WORKTREE_PRUNE_OPTIONS_VERSION: c_uint = 1;
1940
1941 pub type git_repository_mergehead_foreach_cb =
1942 Option<extern "C" fn(oid: *const git_oid, payload: *mut c_void) -> c_int>;
1943
1944 pub type git_repository_fetchhead_foreach_cb = Option<
1945 extern "C" fn(*const c_char, *const c_char, *const git_oid, c_uint, *mut c_void) -> c_int,
1946 >;
1947
1948 git_enum! {
1949 pub enum git_trace_level_t {
1950 /* No tracing will be performed. */
1951 GIT_TRACE_NONE = 0,
1952
1953 /* Severe errors that may impact the program's execution */
1954 GIT_TRACE_FATAL = 1,
1955
1956 /* Errors that do not impact the program's execution */
1957 GIT_TRACE_ERROR = 2,
1958
1959 /* Warnings that suggest abnormal data */
1960 GIT_TRACE_WARN = 3,
1961
1962 /* Informational messages about program execution */
1963 GIT_TRACE_INFO = 4,
1964
1965 /* Detailed data that allows for debugging */
1966 GIT_TRACE_DEBUG = 5,
1967
1968 /* Exceptionally detailed debugging data */
1969 GIT_TRACE_TRACE = 6,
1970 }
1971 }
1972
1973 pub type git_trace_cb = Option<extern "C" fn(level: git_trace_level_t, msg: *const c_char)>;
1974
1975 git_enum! {
1976 pub enum git_feature_t {
1977 GIT_FEATURE_THREADS = 1 << 0,
1978 GIT_FEATURE_HTTPS = 1 << 1,
1979 GIT_FEATURE_SSH = 1 << 2,
1980 GIT_FEATURE_NSEC = 1 << 3,
1981 }
1982 }
1983
1984 #[repr(C)]
1985 pub struct git_message_trailer {
1986 pub key: *const c_char,
1987 pub value: *const c_char,
1988 }
1989
1990 #[repr(C)]
1991 #[derive(Copy, Clone)]
1992 pub struct git_message_trailer_array {
1993 pub trailers: *mut git_message_trailer,
1994 pub count: size_t,
1995 pub _trailer_block: *mut c_char,
1996 }
1997
1998 #[repr(C)]
1999 pub struct git_email_create_options {
2000 pub version: c_uint,
2001 pub flags: u32,
2002 pub diff_opts: git_diff_options,
2003 pub diff_find_opts: git_diff_find_options,
2004 pub subject_prefix: *const c_char,
2005 pub start_number: usize,
2006 pub reroll_number: usize,
2007 }
2008
2009 pub const GIT_EMAIL_CREATE_OPTIONS_VERSION: c_uint = 1;
2010
2011 git_enum! {
2012 pub enum git_email_create_flags_t {
2013 GIT_EMAIL_CREATE_DEFAULT = 0,
2014 GIT_EMAIL_CREATE_OMIT_NUMBERS = 1 << 0,
2015 GIT_EMAIL_CREATE_ALWAYS_NUMBER = 1 << 1,
2016 GIT_EMAIL_CREATE_NO_RENAMES = 1 << 2,
2017 }
2018 }
2019
2020 extern "C" {
2021 // threads
2022 pub fn git_libgit2_init() -> c_int;
2023 pub fn git_libgit2_shutdown() -> c_int;
2024
2025 // repository
2026 pub fn git_repository_new(out: *mut *mut git_repository) -> c_int;
2027 pub fn git_repository_free(repo: *mut git_repository);
2028 pub fn git_repository_open(repo: *mut *mut git_repository, path: *const c_char) -> c_int;
2029 pub fn git_repository_open_bare(repo: *mut *mut git_repository, path: *const c_char) -> c_int;
2030 pub fn git_repository_open_ext(
2031 repo: *mut *mut git_repository,
2032 path: *const c_char,
2033 flags: c_uint,
2034 ceiling_dirs: *const c_char,
2035 ) -> c_int;
2036 pub fn git_repository_open_from_worktree(
2037 repo: *mut *mut git_repository,
2038 worktree: *mut git_worktree,
2039 ) -> c_int;
2040 pub fn git_repository_wrap_odb(repo: *mut *mut git_repository, odb: *mut git_odb) -> c_int;
2041 pub fn git_repository_init(
2042 repo: *mut *mut git_repository,
2043 path: *const c_char,
2044 is_bare: c_uint,
2045 ) -> c_int;
2046 pub fn git_repository_init_ext(
2047 out: *mut *mut git_repository,
2048 repo_path: *const c_char,
2049 opts: *mut git_repository_init_options,
2050 ) -> c_int;
2051 pub fn git_repository_init_init_options(
2052 opts: *mut git_repository_init_options,
2053 version: c_uint,
2054 ) -> c_int;
2055 pub fn git_repository_get_namespace(repo: *mut git_repository) -> *const c_char;
2056 pub fn git_repository_set_namespace(
2057 repo: *mut git_repository,
2058 namespace: *const c_char,
2059 ) -> c_int;
2060 pub fn git_repository_head(out: *mut *mut git_reference, repo: *mut git_repository) -> c_int;
2061 pub fn git_repository_set_head(repo: *mut git_repository, refname: *const c_char) -> c_int;
2062
2063 pub fn git_repository_head_detached(repo: *mut git_repository) -> c_int;
2064 pub fn git_repository_set_head_detached(
2065 repo: *mut git_repository,
2066 commitish: *const git_oid,
2067 ) -> c_int;
2068 pub fn git_repository_set_head_detached_from_annotated(
2069 repo: *mut git_repository,
2070 commitish: *const git_annotated_commit,
2071 ) -> c_int;
2072 pub fn git_repository_set_bare(repo: *mut git_repository) -> c_int;
2073 pub fn git_repository_is_worktree(repo: *const git_repository) -> c_int;
2074 pub fn git_repository_is_bare(repo: *const git_repository) -> c_int;
2075 pub fn git_repository_is_empty(repo: *mut git_repository) -> c_int;
2076 pub fn git_repository_is_shallow(repo: *mut git_repository) -> c_int;
2077 pub fn git_repository_path(repo: *const git_repository) -> *const c_char;
2078 pub fn git_repository_state(repo: *mut git_repository) -> c_int;
2079 pub fn git_repository_workdir(repo: *const git_repository) -> *const c_char;
2080 pub fn git_repository_set_workdir(
2081 repo: *mut git_repository,
2082 workdir: *const c_char,
2083 update_gitlink: c_int,
2084 ) -> c_int;
2085 pub fn git_repository_index(out: *mut *mut git_index, repo: *mut git_repository) -> c_int;
2086 pub fn git_repository_set_index(repo: *mut git_repository, index: *mut git_index) -> c_int;
2087
2088 pub fn git_repository_message(buf: *mut git_buf, repo: *mut git_repository) -> c_int;
2089
2090 pub fn git_repository_message_remove(repo: *mut git_repository) -> c_int;
2091 pub fn git_repository_config(out: *mut *mut git_config, repo: *mut git_repository) -> c_int;
2092 pub fn git_repository_set_config(repo: *mut git_repository, config: *mut git_config) -> c_int;
2093 pub fn git_repository_config_snapshot(
2094 out: *mut *mut git_config,
2095 repo: *mut git_repository,
2096 ) -> c_int;
2097 pub fn git_repository_discover(
2098 out: *mut git_buf,
2099 start_path: *const c_char,
2100 across_fs: c_int,
2101 ceiling_dirs: *const c_char,
2102 ) -> c_int;
2103 pub fn git_repository_set_odb(repo: *mut git_repository, odb: *mut git_odb) -> c_int;
2104
2105 pub fn git_repository_refdb(out: *mut *mut git_refdb, repo: *mut git_repository) -> c_int;
2106 pub fn git_repository_set_refdb(repo: *mut git_repository, refdb: *mut git_refdb) -> c_int;
2107
2108 pub fn git_repository_reinit_filesystem(
2109 repo: *mut git_repository,
2110 recurse_submodules: c_int,
2111 ) -> c_int;
2112 pub fn git_repository_mergehead_foreach(
2113 repo: *mut git_repository,
2114 callback: git_repository_mergehead_foreach_cb,
2115 payload: *mut c_void,
2116 ) -> c_int;
2117 pub fn git_repository_fetchhead_foreach(
2118 repo: *mut git_repository,
2119 callback: git_repository_fetchhead_foreach_cb,
2120 payload: *mut c_void,
2121 ) -> c_int;
2122 pub fn git_ignore_add_rule(repo: *mut git_repository, rules: *const c_char) -> c_int;
2123 pub fn git_ignore_clear_internal_rules(repo: *mut git_repository) -> c_int;
2124 pub fn git_ignore_path_is_ignored(
2125 ignored: *mut c_int,
2126 repo: *mut git_repository,
2127 path: *const c_char,
2128 ) -> c_int;
2129
2130 // revparse
2131 pub fn git_revparse(
2132 revspec: *mut git_revspec,
2133 repo: *mut git_repository,
2134 spec: *const c_char,
2135 ) -> c_int;
2136 pub fn git_revparse_single(
2137 out: *mut *mut git_object,
2138 repo: *mut git_repository,
2139 spec: *const c_char,
2140 ) -> c_int;
2141 pub fn git_revparse_ext(
2142 object_out: *mut *mut git_object,
2143 reference_out: *mut *mut git_reference,
2144 repo: *mut git_repository,
2145 spec: *const c_char,
2146 ) -> c_int;
2147
2148 // object
2149 pub fn git_object_dup(dest: *mut *mut git_object, source: *mut git_object) -> c_int;
2150 pub fn git_object_id(obj: *const git_object) -> *const git_oid;
2151 pub fn git_object_free(object: *mut git_object);
2152 pub fn git_object_lookup(
2153 dest: *mut *mut git_object,
2154 repo: *mut git_repository,
2155 id: *const git_oid,
2156 kind: git_object_t,
2157 ) -> c_int;
2158 pub fn git_object_type(obj: *const git_object) -> git_object_t;
2159 pub fn git_object_peel(
2160 peeled: *mut *mut git_object,
2161 object: *const git_object,
2162 target_type: git_object_t,
2163 ) -> c_int;
2164 pub fn git_object_short_id(out: *mut git_buf, obj: *const git_object) -> c_int;
2165 pub fn git_object_type2string(kind: git_object_t) -> *const c_char;
2166 pub fn git_object_string2type(s: *const c_char) -> git_object_t;
2167 pub fn git_object_typeisloose(kind: git_object_t) -> c_int;
2168
2169 // oid
2170 pub fn git_oid_fromraw(out: *mut git_oid, raw: *const c_uchar) -> c_int;
2171 pub fn git_oid_fromstrn(out: *mut git_oid, str: *const c_char, len: size_t) -> c_int;
2172 pub fn git_oid_tostr(out: *mut c_char, n: size_t, id: *const git_oid) -> *mut c_char;
2173 pub fn git_oid_cmp(a: *const git_oid, b: *const git_oid) -> c_int;
2174 pub fn git_oid_equal(a: *const git_oid, b: *const git_oid) -> c_int;
2175 pub fn git_oid_streq(id: *const git_oid, str: *const c_char) -> c_int;
2176 pub fn git_oid_iszero(id: *const git_oid) -> c_int;
2177
2178 // error
2179 pub fn git_error_last() -> *const git_error;
2180 pub fn git_error_clear();
2181 pub fn git_error_set_str(error_class: c_int, string: *const c_char) -> c_int;
2182
2183 // remote
2184 pub fn git_remote_create(
2185 out: *mut *mut git_remote,
2186 repo: *mut git_repository,
2187 name: *const c_char,
2188 url: *const c_char,
2189 ) -> c_int;
2190 pub fn git_remote_create_with_fetchspec(
2191 out: *mut *mut git_remote,
2192 repo: *mut git_repository,
2193 name: *const c_char,
2194 url: *const c_char,
2195 fetch: *const c_char,
2196 ) -> c_int;
2197 pub fn git_remote_lookup(
2198 out: *mut *mut git_remote,
2199 repo: *mut git_repository,
2200 name: *const c_char,
2201 ) -> c_int;
2202 pub fn git_remote_create_anonymous(
2203 out: *mut *mut git_remote,
2204 repo: *mut git_repository,
2205 url: *const c_char,
2206 ) -> c_int;
2207 pub fn git_remote_create_detached(out: *mut *mut git_remote, url: *const c_char) -> c_int;
2208 pub fn git_remote_delete(repo: *mut git_repository, name: *const c_char) -> c_int;
2209 pub fn git_remote_free(remote: *mut git_remote);
2210 pub fn git_remote_name(remote: *const git_remote) -> *const c_char;
2211 pub fn git_remote_pushurl(remote: *const git_remote) -> *const c_char;
2212 pub fn git_remote_refspec_count(remote: *const git_remote) -> size_t;
2213 pub fn git_remote_url(remote: *const git_remote) -> *const c_char;
2214 pub fn git_remote_connect(
2215 remote: *mut git_remote,
2216 dir: git_direction,
2217 callbacks: *const git_remote_callbacks,
2218 proxy_opts: *const git_proxy_options,
2219 custom_headers: *const git_strarray,
2220 ) -> c_int;
2221 pub fn git_remote_connected(remote: *const git_remote) -> c_int;
2222 pub fn git_remote_disconnect(remote: *mut git_remote) -> c_int;
2223 pub fn git_remote_add_fetch(
2224 repo: *mut git_repository,
2225 remote: *const c_char,
2226 refspec: *const c_char,
2227 ) -> c_int;
2228 pub fn git_remote_add_push(
2229 repo: *mut git_repository,
2230 remote: *const c_char,
2231 refspec: *const c_char,
2232 ) -> c_int;
2233 pub fn git_remote_download(
2234 remote: *mut git_remote,
2235 refspecs: *const git_strarray,
2236 opts: *const git_fetch_options,
2237 ) -> c_int;
2238 pub fn git_remote_stop(remote: *mut git_remote) -> c_int;
2239 pub fn git_remote_dup(dest: *mut *mut git_remote, source: *mut git_remote) -> c_int;
2240 pub fn git_remote_get_fetch_refspecs(
2241 array: *mut git_strarray,
2242 remote: *const git_remote,
2243 ) -> c_int;
2244 pub fn git_remote_get_push_refspecs(
2245 array: *mut git_strarray,
2246 remote: *const git_remote,
2247 ) -> c_int;
2248 pub fn git_remote_get_refspec(remote: *const git_remote, n: size_t) -> *const git_refspec;
2249 pub fn git_remote_is_valid_name(remote_name: *const c_char) -> c_int;
2250 pub fn git_remote_list(out: *mut git_strarray, repo: *mut git_repository) -> c_int;
2251 pub fn git_remote_rename(
2252 problems: *mut git_strarray,
2253 repo: *mut git_repository,
2254 name: *const c_char,
2255 new_name: *const c_char,
2256 ) -> c_int;
2257 pub fn git_remote_fetch(
2258 remote: *mut git_remote,
2259 refspecs: *const git_strarray,
2260 opts: *const git_fetch_options,
2261 reflog_message: *const c_char,
2262 ) -> c_int;
2263 pub fn git_remote_push(
2264 remote: *mut git_remote,
2265 refspecs: *const git_strarray,
2266 opts: *const git_push_options,
2267 ) -> c_int;
2268 pub fn git_remote_update_tips(
2269 remote: *mut git_remote,
2270 callbacks: *const git_remote_callbacks,
2271 update_fetchead: c_int,
2272 download_tags: git_remote_autotag_option_t,
2273 reflog_message: *const c_char,
2274 ) -> c_int;
2275 pub fn git_remote_set_url(
2276 repo: *mut git_repository,
2277 remote: *const c_char,
2278 url: *const c_char,
2279 ) -> c_int;
2280 pub fn git_remote_set_pushurl(
2281 repo: *mut git_repository,
2282 remote: *const c_char,
2283 pushurl: *const c_char,
2284 ) -> c_int;
2285 pub fn git_remote_init_callbacks(opts: *mut git_remote_callbacks, version: c_uint) -> c_int;
2286 pub fn git_fetch_init_options(opts: *mut git_fetch_options, version: c_uint) -> c_int;
2287 pub fn git_remote_stats(remote: *mut git_remote) -> *const git_indexer_progress;
2288 pub fn git_remote_ls(
2289 out: *mut *mut *const git_remote_head,
2290 size: *mut size_t,
2291 remote: *mut git_remote,
2292 ) -> c_int;
2293 pub fn git_remote_set_autotag(
2294 repo: *mut git_repository,
2295 remote: *const c_char,
2296 value: git_remote_autotag_option_t,
2297 ) -> c_int;
2298 pub fn git_remote_prune(
2299 remote: *mut git_remote,
2300 callbacks: *const git_remote_callbacks,
2301 ) -> c_int;
2302 pub fn git_remote_default_branch(out: *mut git_buf, remote: *mut git_remote) -> c_int;
2303
2304 // refspec
2305 pub fn git_refspec_direction(spec: *const git_refspec) -> git_direction;
2306 pub fn git_refspec_dst(spec: *const git_refspec) -> *const c_char;
2307 pub fn git_refspec_dst_matches(spec: *const git_refspec, refname: *const c_char) -> c_int;
2308 pub fn git_refspec_src(spec: *const git_refspec) -> *const c_char;
2309 pub fn git_refspec_src_matches(spec: *const git_refspec, refname: *const c_char) -> c_int;
2310 pub fn git_refspec_force(spec: *const git_refspec) -> c_int;
2311 pub fn git_refspec_string(spec: *const git_refspec) -> *const c_char;
2312 pub fn git_refspec_transform(
2313 out: *mut git_buf,
2314 spec: *const git_refspec,
2315 name: *const c_char,
2316 ) -> c_int;
2317 pub fn git_refspec_rtransform(
2318 out: *mut git_buf,
2319 spec: *const git_refspec,
2320 name: *const c_char,
2321 ) -> c_int;
2322
2323 // strarray
2324 pub fn git_strarray_free(array: *mut git_strarray);
2325
2326 // oidarray
2327 pub fn git_oidarray_free(array: *mut git_oidarray);
2328
2329 // signature
2330 pub fn git_signature_default(out: *mut *mut git_signature, repo: *mut git_repository) -> c_int;
2331 pub fn git_signature_free(sig: *mut git_signature);
2332 pub fn git_signature_new(
2333 out: *mut *mut git_signature,
2334 name: *const c_char,
2335 email: *const c_char,
2336 time: git_time_t,
2337 offset: c_int,
2338 ) -> c_int;
2339 pub fn git_signature_now(
2340 out: *mut *mut git_signature,
2341 name: *const c_char,
2342 email: *const c_char,
2343 ) -> c_int;
2344 pub fn git_signature_dup(dest: *mut *mut git_signature, sig: *const git_signature) -> c_int;
2345
2346 // status
2347 pub fn git_status_list_new(
2348 out: *mut *mut git_status_list,
2349 repo: *mut git_repository,
2350 options: *const git_status_options,
2351 ) -> c_int;
2352 pub fn git_status_list_entrycount(list: *mut git_status_list) -> size_t;
2353 pub fn git_status_byindex(
2354 statuslist: *mut git_status_list,
2355 idx: size_t,
2356 ) -> *const git_status_entry;
2357 pub fn git_status_list_free(list: *mut git_status_list);
2358 pub fn git_status_init_options(opts: *mut git_status_options, version: c_uint) -> c_int;
2359 pub fn git_status_file(
2360 status_flags: *mut c_uint,
2361 repo: *mut git_repository,
2362 path: *const c_char,
2363 ) -> c_int;
2364 pub fn git_status_should_ignore(
2365 ignored: *mut c_int,
2366 repo: *mut git_repository,
2367 path: *const c_char,
2368 ) -> c_int;
2369
2370 // clone
2371 pub fn git_clone(
2372 out: *mut *mut git_repository,
2373 url: *const c_char,
2374 local_path: *const c_char,
2375 options: *const git_clone_options,
2376 ) -> c_int;
2377 pub fn git_clone_init_options(opts: *mut git_clone_options, version: c_uint) -> c_int;
2378
2379 // reset
2380 pub fn git_reset(
2381 repo: *mut git_repository,
2382 target: *const git_object,
2383 reset_type: git_reset_t,
2384 checkout_opts: *const git_checkout_options,
2385 ) -> c_int;
2386 pub fn git_reset_default(
2387 repo: *mut git_repository,
2388 target: *const git_object,
2389 pathspecs: *const git_strarray,
2390 ) -> c_int;
2391
2392 // reference
2393 pub fn git_reference_cmp(ref1: *const git_reference, ref2: *const git_reference) -> c_int;
2394 pub fn git_reference_delete(r: *mut git_reference) -> c_int;
2395 pub fn git_reference_free(r: *mut git_reference);
2396 pub fn git_reference_is_branch(r: *const git_reference) -> c_int;
2397 pub fn git_reference_is_note(r: *const git_reference) -> c_int;
2398 pub fn git_reference_is_remote(r: *const git_reference) -> c_int;
2399 pub fn git_reference_is_tag(r: *const git_reference) -> c_int;
2400 pub fn git_reference_is_valid_name(name: *const c_char) -> c_int;
2401 pub fn git_reference_lookup(
2402 out: *mut *mut git_reference,
2403 repo: *mut git_repository,
2404 name: *const c_char,
2405 ) -> c_int;
2406 pub fn git_reference_dwim(
2407 out: *mut *mut git_reference,
2408 repo: *mut git_repository,
2409 refname: *const c_char,
2410 ) -> c_int;
2411 pub fn git_reference_name(r: *const git_reference) -> *const c_char;
2412 pub fn git_reference_name_to_id(
2413 out: *mut git_oid,
2414 repo: *mut git_repository,
2415 name: *const c_char,
2416 ) -> c_int;
2417 pub fn git_reference_peel(
2418 out: *mut *mut git_object,
2419 r: *const git_reference,
2420 otype: git_object_t,
2421 ) -> c_int;
2422 pub fn git_reference_rename(
2423 new_ref: *mut *mut git_reference,
2424 r: *mut git_reference,
2425 new_name: *const c_char,
2426 force: c_int,
2427 log_message: *const c_char,
2428 ) -> c_int;
2429 pub fn git_reference_resolve(out: *mut *mut git_reference, r: *const git_reference) -> c_int;
2430 pub fn git_reference_shorthand(r: *const git_reference) -> *const c_char;
2431 pub fn git_reference_symbolic_target(r: *const git_reference) -> *const c_char;
2432 pub fn git_reference_target(r: *const git_reference) -> *const git_oid;
2433 pub fn git_reference_target_peel(r: *const git_reference) -> *const git_oid;
2434 pub fn git_reference_set_target(
2435 out: *mut *mut git_reference,
2436 r: *mut git_reference,
2437 id: *const git_oid,
2438 log_message: *const c_char,
2439 ) -> c_int;
2440 pub fn git_reference_type(r: *const git_reference) -> git_reference_t;
2441 pub fn git_reference_iterator_new(
2442 out: *mut *mut git_reference_iterator,
2443 repo: *mut git_repository,
2444 ) -> c_int;
2445 pub fn git_reference_iterator_glob_new(
2446 out: *mut *mut git_reference_iterator,
2447 repo: *mut git_repository,
2448 glob: *const c_char,
2449 ) -> c_int;
2450 pub fn git_reference_iterator_free(iter: *mut git_reference_iterator);
2451 pub fn git_reference_next(
2452 out: *mut *mut git_reference,
2453 iter: *mut git_reference_iterator,
2454 ) -> c_int;
2455 pub fn git_reference_next_name(
2456 out: *mut *const c_char,
2457 iter: *mut git_reference_iterator,
2458 ) -> c_int;
2459 pub fn git_reference_create(
2460 out: *mut *mut git_reference,
2461 repo: *mut git_repository,
2462 name: *const c_char,
2463 id: *const git_oid,
2464 force: c_int,
2465 log_message: *const c_char,
2466 ) -> c_int;
2467 pub fn git_reference_symbolic_create(
2468 out: *mut *mut git_reference,
2469 repo: *mut git_repository,
2470 name: *const c_char,
2471 target: *const c_char,
2472 force: c_int,
2473 log_message: *const c_char,
2474 ) -> c_int;
2475 pub fn git_reference_create_matching(
2476 out: *mut *mut git_reference,
2477 repo: *mut git_repository,
2478 name: *const c_char,
2479 id: *const git_oid,
2480 force: c_int,
2481 current_id: *const git_oid,
2482 log_message: *const c_char,
2483 ) -> c_int;
2484 pub fn git_reference_symbolic_create_matching(
2485 out: *mut *mut git_reference,
2486 repo: *mut git_repository,
2487 name: *const c_char,
2488 target: *const c_char,
2489 force: c_int,
2490 current_id: *const c_char,
2491 log_message: *const c_char,
2492 ) -> c_int;
2493 pub fn git_reference_has_log(repo: *mut git_repository, name: *const c_char) -> c_int;
2494 pub fn git_reference_ensure_log(repo: *mut git_repository, name: *const c_char) -> c_int;
2495 pub fn git_reference_normalize_name(
2496 buffer_out: *mut c_char,
2497 buffer_size: size_t,
2498 name: *const c_char,
2499 flags: u32,
2500 ) -> c_int;
2501
2502 // stash
2503 pub fn git_stash_save(
2504 out: *mut git_oid,
2505 repo: *mut git_repository,
2506 stasher: *const git_signature,
2507 message: *const c_char,
2508 flags: c_uint,
2509 ) -> c_int;
2510
2511 pub fn git_stash_apply_init_options(
2512 opts: *mut git_stash_apply_options,
2513 version: c_uint,
2514 ) -> c_int;
2515
2516 pub fn git_stash_apply(
2517 repo: *mut git_repository,
2518 index: size_t,
2519 options: *const git_stash_apply_options,
2520 ) -> c_int;
2521
2522 pub fn git_stash_foreach(
2523 repo: *mut git_repository,
2524 callback: git_stash_cb,
2525 payload: *mut c_void,
2526 ) -> c_int;
2527
2528 pub fn git_stash_drop(repo: *mut git_repository, index: size_t) -> c_int;
2529
2530 pub fn git_stash_pop(
2531 repo: *mut git_repository,
2532 index: size_t,
2533 options: *const git_stash_apply_options,
2534 ) -> c_int;
2535
2536 // submodules
2537 pub fn git_submodule_add_finalize(submodule: *mut git_submodule) -> c_int;
2538 pub fn git_submodule_add_setup(
2539 submodule: *mut *mut git_submodule,
2540 repo: *mut git_repository,
2541 url: *const c_char,
2542 path: *const c_char,
2543 use_gitlink: c_int,
2544 ) -> c_int;
2545 pub fn git_submodule_add_to_index(submodule: *mut git_submodule, write_index: c_int) -> c_int;
2546 pub fn git_submodule_branch(submodule: *mut git_submodule) -> *const c_char;
2547 pub fn git_submodule_clone(
2548 repo: *mut *mut git_repository,
2549 submodule: *mut git_submodule,
2550 opts: *const git_submodule_update_options,
2551 ) -> c_int;
2552 pub fn git_submodule_foreach(
2553 repo: *mut git_repository,
2554 callback: git_submodule_cb,
2555 payload: *mut c_void,
2556 ) -> c_int;
2557 pub fn git_submodule_free(submodule: *mut git_submodule);
2558 pub fn git_submodule_head_id(submodule: *mut git_submodule) -> *const git_oid;
2559 pub fn git_submodule_ignore(submodule: *mut git_submodule) -> git_submodule_ignore_t;
2560 pub fn git_submodule_index_id(submodule: *mut git_submodule) -> *const git_oid;
2561 pub fn git_submodule_init(submodule: *mut git_submodule, overwrite: c_int) -> c_int;
2562 pub fn git_submodule_location(status: *mut c_uint, submodule: *mut git_submodule) -> c_int;
2563 pub fn git_submodule_lookup(
2564 out: *mut *mut git_submodule,
2565 repo: *mut git_repository,
2566 name: *const c_char,
2567 ) -> c_int;
2568 pub fn git_submodule_name(submodule: *mut git_submodule) -> *const c_char;
2569 pub fn git_submodule_open(
2570 repo: *mut *mut git_repository,
2571 submodule: *mut git_submodule,
2572 ) -> c_int;
2573 pub fn git_submodule_path(submodule: *mut git_submodule) -> *const c_char;
2574 pub fn git_submodule_reload(submodule: *mut git_submodule, force: c_int) -> c_int;
2575 pub fn git_submodule_set_ignore(
2576 repo: *mut git_repository,
2577 name: *const c_char,
2578 ignore: git_submodule_ignore_t,
2579 ) -> c_int;
2580 pub fn git_submodule_set_update(
2581 repo: *mut git_repository,
2582 name: *const c_char,
2583 update: git_submodule_update_t,
2584 ) -> c_int;
2585 pub fn git_submodule_set_url(
2586 repo: *mut git_repository,
2587 name: *const c_char,
2588 url: *const c_char,
2589 ) -> c_int;
2590 pub fn git_submodule_sync(submodule: *mut git_submodule) -> c_int;
2591 pub fn git_submodule_update_strategy(submodule: *mut git_submodule) -> git_submodule_update_t;
2592 pub fn git_submodule_update(
2593 submodule: *mut git_submodule,
2594 init: c_int,
2595 options: *mut git_submodule_update_options,
2596 ) -> c_int;
2597 pub fn git_submodule_update_init_options(
2598 options: *mut git_submodule_update_options,
2599 version: c_uint,
2600 ) -> c_int;
2601 pub fn git_submodule_url(submodule: *mut git_submodule) -> *const c_char;
2602 pub fn git_submodule_wd_id(submodule: *mut git_submodule) -> *const git_oid;
2603 pub fn git_submodule_status(
2604 status: *mut c_uint,
2605 repo: *mut git_repository,
2606 name: *const c_char,
2607 ignore: git_submodule_ignore_t,
2608 ) -> c_int;
2609 pub fn git_submodule_set_branch(
2610 repo: *mut git_repository,
2611 name: *const c_char,
2612 branch: *const c_char,
2613 ) -> c_int;
2614
2615 // blob
2616 pub fn git_blob_free(blob: *mut git_blob);
2617 pub fn git_blob_id(blob: *const git_blob) -> *const git_oid;
2618 pub fn git_blob_is_binary(blob: *const git_blob) -> c_int;
2619 pub fn git_blob_lookup(
2620 blob: *mut *mut git_blob,
2621 repo: *mut git_repository,
2622 id: *const git_oid,
2623 ) -> c_int;
2624 pub fn git_blob_lookup_prefix(
2625 blob: *mut *mut git_blob,
2626 repo: *mut git_repository,
2627 id: *const git_oid,
2628 len: size_t,
2629 ) -> c_int;
2630 pub fn git_blob_rawcontent(blob: *const git_blob) -> *const c_void;
2631 pub fn git_blob_rawsize(blob: *const git_blob) -> git_object_size_t;
2632 pub fn git_blob_create_frombuffer(
2633 id: *mut git_oid,
2634 repo: *mut git_repository,
2635 buffer: *const c_void,
2636 len: size_t,
2637 ) -> c_int;
2638 pub fn git_blob_create_fromdisk(
2639 id: *mut git_oid,
2640 repo: *mut git_repository,
2641 path: *const c_char,
2642 ) -> c_int;
2643 pub fn git_blob_create_fromworkdir(
2644 id: *mut git_oid,
2645 repo: *mut git_repository,
2646 relative_path: *const c_char,
2647 ) -> c_int;
2648 pub fn git_blob_create_fromstream(
2649 out: *mut *mut git_writestream,
2650 repo: *mut git_repository,
2651 hintpath: *const c_char,
2652 ) -> c_int;
2653 pub fn git_blob_create_fromstream_commit(
2654 id: *mut git_oid,
2655 stream: *mut git_writestream,
2656 ) -> c_int;
2657
2658 // tree
2659 pub fn git_tree_entry_byid(tree: *const git_tree, id: *const git_oid) -> *const git_tree_entry;
2660 pub fn git_tree_entry_byindex(tree: *const git_tree, idx: size_t) -> *const git_tree_entry;
2661 pub fn git_tree_entry_byname(
2662 tree: *const git_tree,
2663 filename: *const c_char,
2664 ) -> *const git_tree_entry;
2665 pub fn git_tree_entry_bypath(
2666 out: *mut *mut git_tree_entry,
2667 tree: *const git_tree,
2668 filename: *const c_char,
2669 ) -> c_int;
2670 pub fn git_tree_entry_cmp(e1: *const git_tree_entry, e2: *const git_tree_entry) -> c_int;
2671 pub fn git_tree_entry_dup(dest: *mut *mut git_tree_entry, src: *const git_tree_entry) -> c_int;
2672 pub fn git_tree_entry_filemode(entry: *const git_tree_entry) -> git_filemode_t;
2673 pub fn git_tree_entry_filemode_raw(entry: *const git_tree_entry) -> git_filemode_t;
2674 pub fn git_tree_entry_free(entry: *mut git_tree_entry);
2675 pub fn git_tree_entry_id(entry: *const git_tree_entry) -> *const git_oid;
2676 pub fn git_tree_entry_name(entry: *const git_tree_entry) -> *const c_char;
2677 pub fn git_tree_entry_to_object(
2678 out: *mut *mut git_object,
2679 repo: *mut git_repository,
2680 entry: *const git_tree_entry,
2681 ) -> c_int;
2682 pub fn git_tree_entry_type(entry: *const git_tree_entry) -> git_object_t;
2683 pub fn git_tree_entrycount(tree: *const git_tree) -> size_t;
2684 pub fn git_tree_free(tree: *mut git_tree);
2685 pub fn git_tree_id(tree: *const git_tree) -> *const git_oid;
2686 pub fn git_tree_lookup(
2687 tree: *mut *mut git_tree,
2688 repo: *mut git_repository,
2689 id: *const git_oid,
2690 ) -> c_int;
2691 pub fn git_tree_walk(
2692 tree: *const git_tree,
2693 mode: git_treewalk_mode,
2694 callback: git_treewalk_cb,
2695 payload: *mut c_void,
2696 ) -> c_int;
2697 pub fn git_tree_create_updated(
2698 out: *mut git_oid,
2699 repo: *mut git_repository,
2700 baseline: *mut git_tree,
2701 nupdates: usize,
2702 updates: *const git_tree_update,
2703 ) -> c_int;
2704
2705 // treebuilder
2706 pub fn git_treebuilder_new(
2707 out: *mut *mut git_treebuilder,
2708 repo: *mut git_repository,
2709 source: *const git_tree,
2710 ) -> c_int;
2711 pub fn git_treebuilder_clear(bld: *mut git_treebuilder) -> c_int;
2712 pub fn git_treebuilder_entrycount(bld: *mut git_treebuilder) -> size_t;
2713 pub fn git_treebuilder_free(bld: *mut git_treebuilder);
2714 pub fn git_treebuilder_get(
2715 bld: *mut git_treebuilder,
2716 filename: *const c_char,
2717 ) -> *const git_tree_entry;
2718 pub fn git_treebuilder_insert(
2719 out: *mut *const git_tree_entry,
2720 bld: *mut git_treebuilder,
2721 filename: *const c_char,
2722 id: *const git_oid,
2723 filemode: git_filemode_t,
2724 ) -> c_int;
2725 pub fn git_treebuilder_remove(bld: *mut git_treebuilder, filename: *const c_char) -> c_int;
2726 pub fn git_treebuilder_filter(
2727 bld: *mut git_treebuilder,
2728 filter: git_treebuilder_filter_cb,
2729 payload: *mut c_void,
2730 ) -> c_int;
2731 pub fn git_treebuilder_write(id: *mut git_oid, bld: *mut git_treebuilder) -> c_int;
2732
2733 // buf
2734 pub fn git_buf_dispose(buffer: *mut git_buf);
2735 pub fn git_buf_grow(buffer: *mut git_buf, target_size: size_t) -> c_int;
2736 pub fn git_buf_set(buffer: *mut git_buf, data: *const c_void, datalen: size_t) -> c_int;
2737
2738 // commit
2739 pub fn git_commit_author(commit: *const git_commit) -> *const git_signature;
2740 pub fn git_commit_author_with_mailmap(
2741 out: *mut *mut git_signature,
2742 commit: *const git_commit,
2743 mailmap: *const git_mailmap,
2744 ) -> c_int;
2745 pub fn git_commit_committer(commit: *const git_commit) -> *const git_signature;
2746 pub fn git_commit_committer_with_mailmap(
2747 out: *mut *mut git_signature,
2748 commit: *const git_commit,
2749 mailmap: *const git_mailmap,
2750 ) -> c_int;
2751 pub fn git_commit_free(commit: *mut git_commit);
2752 pub fn git_commit_id(commit: *const git_commit) -> *const git_oid;
2753 pub fn git_commit_lookup(
2754 commit: *mut *mut git_commit,
2755 repo: *mut git_repository,
2756 id: *const git_oid,
2757 ) -> c_int;
2758 pub fn git_commit_message(commit: *const git_commit) -> *const c_char;
2759 pub fn git_commit_message_encoding(commit: *const git_commit) -> *const c_char;
2760 pub fn git_commit_message_raw(commit: *const git_commit) -> *const c_char;
2761 pub fn git_commit_nth_gen_ancestor(
2762 commit: *mut *mut git_commit,
2763 commit: *const git_commit,
2764 n: c_uint,
2765 ) -> c_int;
2766 pub fn git_commit_parent(
2767 out: *mut *mut git_commit,
2768 commit: *const git_commit,
2769 n: c_uint,
2770 ) -> c_int;
2771 pub fn git_commit_parent_id(commit: *const git_commit, n: c_uint) -> *const git_oid;
2772 pub fn git_commit_parentcount(commit: *const git_commit) -> c_uint;
2773 pub fn git_commit_raw_header(commit: *const git_commit) -> *const c_char;
2774 pub fn git_commit_summary(commit: *mut git_commit) -> *const c_char;
2775 pub fn git_commit_body(commit: *mut git_commit) -> *const c_char;
2776 pub fn git_commit_time(commit: *const git_commit) -> git_time_t;
2777 pub fn git_commit_time_offset(commit: *const git_commit) -> c_int;
2778 pub fn git_commit_tree(tree_out: *mut *mut git_tree, commit: *const git_commit) -> c_int;
2779 pub fn git_commit_tree_id(commit: *const git_commit) -> *const git_oid;
2780 pub fn git_commit_amend(
2781 id: *mut git_oid,
2782 commit_to_amend: *const git_commit,
2783 update_ref: *const c_char,
2784 author: *const git_signature,
2785 committer: *const git_signature,
2786 message_encoding: *const c_char,
2787 message: *const c_char,
2788 tree: *const git_tree,
2789 ) -> c_int;
2790 pub fn git_commit_create(
2791 id: *mut git_oid,
2792 repo: *mut git_repository,
2793 update_ref: *const c_char,
2794 author: *const git_signature,
2795 committer: *const git_signature,
2796 message_encoding: *const c_char,
2797 message: *const c_char,
2798 tree: *const git_tree,
2799 parent_count: size_t,
2800 parents: *mut *const git_commit,
2801 ) -> c_int;
2802 pub fn git_commit_create_buffer(
2803 out: *mut git_buf,
2804 repo: *mut git_repository,
2805 author: *const git_signature,
2806 committer: *const git_signature,
2807 message_encoding: *const c_char,
2808 message: *const c_char,
2809 tree: *const git_tree,
2810 parent_count: size_t,
2811 parents: *mut *const git_commit,
2812 ) -> c_int;
2813 pub fn git_commit_header_field(
2814 out: *mut git_buf,
2815 commit: *const git_commit,
2816 field: *const c_char,
2817 ) -> c_int;
2818 pub fn git_annotated_commit_lookup(
2819 out: *mut *mut git_annotated_commit,
2820 repo: *mut git_repository,
2821 id: *const git_oid,
2822 ) -> c_int;
2823 pub fn git_commit_create_with_signature(
2824 id: *mut git_oid,
2825 repo: *mut git_repository,
2826 commit_content: *const c_char,
2827 signature: *const c_char,
2828 signature_field: *const c_char,
2829 ) -> c_int;
2830 pub fn git_commit_extract_signature(
2831 signature: *mut git_buf,
2832 signed_data: *mut git_buf,
2833 repo: *mut git_repository,
2834 commit_id: *mut git_oid,
2835 field: *const c_char,
2836 ) -> c_int;
2837
2838 // branch
2839 pub fn git_branch_create(
2840 out: *mut *mut git_reference,
2841 repo: *mut git_repository,
2842 branch_name: *const c_char,
2843 target: *const git_commit,
2844 force: c_int,
2845 ) -> c_int;
2846 pub fn git_branch_create_from_annotated(
2847 ref_out: *mut *mut git_reference,
2848 repository: *mut git_repository,
2849 branch_name: *const c_char,
2850 commit: *const git_annotated_commit,
2851 force: c_int,
2852 ) -> c_int;
2853 pub fn git_branch_delete(branch: *mut git_reference) -> c_int;
2854 pub fn git_branch_is_head(branch: *const git_reference) -> c_int;
2855 pub fn git_branch_iterator_free(iter: *mut git_branch_iterator);
2856 pub fn git_branch_iterator_new(
2857 iter: *mut *mut git_branch_iterator,
2858 repo: *mut git_repository,
2859 list_flags: git_branch_t,
2860 ) -> c_int;
2861 pub fn git_branch_lookup(
2862 out: *mut *mut git_reference,
2863 repo: *mut git_repository,
2864 branch_name: *const c_char,
2865 branch_type: git_branch_t,
2866 ) -> c_int;
2867 pub fn git_branch_move(
2868 out: *mut *mut git_reference,
2869 branch: *mut git_reference,
2870 new_branch_name: *const c_char,
2871 force: c_int,
2872 ) -> c_int;
2873 pub fn git_branch_name(out: *mut *const c_char, branch: *const git_reference) -> c_int;
2874 pub fn git_branch_name_is_valid(valid: *mut c_int, name: *const c_char) -> c_int;
2875 pub fn git_branch_remote_name(
2876 out: *mut git_buf,
2877 repo: *mut git_repository,
2878 refname: *const c_char,
2879 ) -> c_int;
2880 pub fn git_branch_next(
2881 out: *mut *mut git_reference,
2882 out_type: *mut git_branch_t,
2883 iter: *mut git_branch_iterator,
2884 ) -> c_int;
2885 pub fn git_branch_set_upstream(
2886 branch: *mut git_reference,
2887 upstream_name: *const c_char,
2888 ) -> c_int;
2889 pub fn git_branch_upstream(out: *mut *mut git_reference, branch: *const git_reference)
2890 -> c_int;
2891 pub fn git_branch_upstream_name(
2892 out: *mut git_buf,
2893 repo: *mut git_repository,
2894 refname: *const c_char,
2895 ) -> c_int;
2896 pub fn git_branch_upstream_remote(
2897 out: *mut git_buf,
2898 repo: *mut git_repository,
2899 refname: *const c_char,
2900 ) -> c_int;
2901
2902 // index
2903 pub fn git_index_version(index: *mut git_index) -> c_uint;
2904 pub fn git_index_set_version(index: *mut git_index, version: c_uint) -> c_int;
2905 pub fn git_index_add(index: *mut git_index, entry: *const git_index_entry) -> c_int;
2906 pub fn git_index_add_all(
2907 index: *mut git_index,
2908 pathspec: *const git_strarray,
2909 flags: c_uint,
2910 callback: git_index_matched_path_cb,
2911 payload: *mut c_void,
2912 ) -> c_int;
2913 pub fn git_index_add_bypath(index: *mut git_index, path: *const c_char) -> c_int;
2914 pub fn git_index_add_frombuffer(
2915 index: *mut git_index,
2916 entry: *const git_index_entry,
2917 buffer: *const c_void,
2918 len: size_t,
2919 ) -> c_int;
2920 pub fn git_index_conflict_add(
2921 index: *mut git_index,
2922 ancestor_entry: *const git_index_entry,
2923 our_entry: *const git_index_entry,
2924 their_entry: *const git_index_entry,
2925 ) -> c_int;
2926 pub fn git_index_conflict_remove(index: *mut git_index, path: *const c_char) -> c_int;
2927 pub fn git_index_conflict_get(
2928 ancestor_out: *mut *const git_index_entry,
2929 our_out: *mut *const git_index_entry,
2930 their_out: *mut *const git_index_entry,
2931 index: *mut git_index,
2932 path: *const c_char,
2933 ) -> c_int;
2934 pub fn git_index_conflict_iterator_new(
2935 iter: *mut *mut git_index_conflict_iterator,
2936 index: *mut git_index,
2937 ) -> c_int;
2938 pub fn git_index_conflict_next(
2939 ancestor_out: *mut *const git_index_entry,
2940 our_out: *mut *const git_index_entry,
2941 their_out: *mut *const git_index_entry,
2942 iter: *mut git_index_conflict_iterator,
2943 ) -> c_int;
2944 pub fn git_index_conflict_iterator_free(iter: *mut git_index_conflict_iterator);
2945 pub fn git_index_clear(index: *mut git_index) -> c_int;
2946 pub fn git_index_entry_stage(entry: *const git_index_entry) -> c_int;
2947 pub fn git_index_entrycount(entry: *const git_index) -> size_t;
2948 pub fn git_index_find(at_pos: *mut size_t, index: *mut git_index, path: *const c_char)
2949 -> c_int;
2950 pub fn git_index_free(index: *mut git_index);
2951 pub fn git_index_get_byindex(index: *mut git_index, n: size_t) -> *const git_index_entry;
2952 pub fn git_index_get_bypath(
2953 index: *mut git_index,
2954 path: *const c_char,
2955 stage: c_int,
2956 ) -> *const git_index_entry;
2957 pub fn git_index_has_conflicts(index: *const git_index) -> c_int;
2958 pub fn git_index_new(index: *mut *mut git_index) -> c_int;
2959 pub fn git_index_open(index: *mut *mut git_index, index_path: *const c_char) -> c_int;
2960 pub fn git_index_path(index: *const git_index) -> *const c_char;
2961 pub fn git_index_read(index: *mut git_index, force: c_int) -> c_int;
2962 pub fn git_index_read_tree(index: *mut git_index, tree: *const git_tree) -> c_int;
2963 pub fn git_index_remove(index: *mut git_index, path: *const c_char, stage: c_int) -> c_int;
2964 pub fn git_index_remove_all(
2965 index: *mut git_index,
2966 pathspec: *const git_strarray,
2967 callback: git_index_matched_path_cb,
2968 payload: *mut c_void,
2969 ) -> c_int;
2970 pub fn git_index_remove_bypath(index: *mut git_index, path: *const c_char) -> c_int;
2971 pub fn git_index_remove_directory(
2972 index: *mut git_index,
2973 dir: *const c_char,
2974 stage: c_int,
2975 ) -> c_int;
2976 pub fn git_index_update_all(
2977 index: *mut git_index,
2978 pathspec: *const git_strarray,
2979 callback: git_index_matched_path_cb,
2980 payload: *mut c_void,
2981 ) -> c_int;
2982 pub fn git_index_write(index: *mut git_index) -> c_int;
2983 pub fn git_index_write_tree(out: *mut git_oid, index: *mut git_index) -> c_int;
2984 pub fn git_index_write_tree_to(
2985 out: *mut git_oid,
2986 index: *mut git_index,
2987 repo: *mut git_repository,
2988 ) -> c_int;
2989
2990 // config
2991 pub fn git_config_add_file_ondisk(
2992 cfg: *mut git_config,
2993 path: *const c_char,
2994 level: git_config_level_t,
2995 repo: *const git_repository,
2996 force: c_int,
2997 ) -> c_int;
2998 pub fn git_config_delete_entry(cfg: *mut git_config, name: *const c_char) -> c_int;
2999 pub fn git_config_delete_multivar(
3000 cfg: *mut git_config,
3001 name: *const c_char,
3002 regexp: *const c_char,
3003 ) -> c_int;
3004 pub fn git_config_find_programdata(out: *mut git_buf) -> c_int;
3005 pub fn git_config_find_global(out: *mut git_buf) -> c_int;
3006 pub fn git_config_find_system(out: *mut git_buf) -> c_int;
3007 pub fn git_config_find_xdg(out: *mut git_buf) -> c_int;
3008 pub fn git_config_free(cfg: *mut git_config);
3009 pub fn git_config_get_bool(
3010 out: *mut c_int,
3011 cfg: *const git_config,
3012 name: *const c_char,
3013 ) -> c_int;
3014 pub fn git_config_get_entry(
3015 out: *mut *mut git_config_entry,
3016 cfg: *const git_config,
3017 name: *const c_char,
3018 ) -> c_int;
3019 pub fn git_config_get_int32(
3020 out: *mut i32,
3021 cfg: *const git_config,
3022 name: *const c_char,
3023 ) -> c_int;
3024 pub fn git_config_get_int64(
3025 out: *mut i64,
3026 cfg: *const git_config,
3027 name: *const c_char,
3028 ) -> c_int;
3029 pub fn git_config_get_string(
3030 out: *mut *const c_char,
3031 cfg: *const git_config,
3032 name: *const c_char,
3033 ) -> c_int;
3034 pub fn git_config_get_string_buf(
3035 out: *mut git_buf,
3036 cfg: *const git_config,
3037 name: *const c_char,
3038 ) -> c_int;
3039 pub fn git_config_get_path(
3040 out: *mut git_buf,
3041 cfg: *const git_config,
3042 name: *const c_char,
3043 ) -> c_int;
3044 pub fn git_config_iterator_free(iter: *mut git_config_iterator);
3045 pub fn git_config_iterator_glob_new(
3046 out: *mut *mut git_config_iterator,
3047 cfg: *const git_config,
3048 regexp: *const c_char,
3049 ) -> c_int;
3050 pub fn git_config_iterator_new(
3051 out: *mut *mut git_config_iterator,
3052 cfg: *const git_config,
3053 ) -> c_int;
3054 pub fn git_config_new(out: *mut *mut git_config) -> c_int;
3055 pub fn git_config_next(
3056 entry: *mut *mut git_config_entry,
3057 iter: *mut git_config_iterator,
3058 ) -> c_int;
3059 pub fn git_config_open_default(out: *mut *mut git_config) -> c_int;
3060 pub fn git_config_open_global(out: *mut *mut git_config, config: *mut git_config) -> c_int;
3061 pub fn git_config_open_level(
3062 out: *mut *mut git_config,
3063 parent: *const git_config,
3064 level: git_config_level_t,
3065 ) -> c_int;
3066 pub fn git_config_open_ondisk(out: *mut *mut git_config, path: *const c_char) -> c_int;
3067 pub fn git_config_parse_bool(out: *mut c_int, value: *const c_char) -> c_int;
3068 pub fn git_config_parse_int32(out: *mut i32, value: *const c_char) -> c_int;
3069 pub fn git_config_parse_int64(out: *mut i64, value: *const c_char) -> c_int;
3070 pub fn git_config_set_bool(cfg: *mut git_config, name: *const c_char, value: c_int) -> c_int;
3071 pub fn git_config_set_int32(cfg: *mut git_config, name: *const c_char, value: i32) -> c_int;
3072 pub fn git_config_set_int64(cfg: *mut git_config, name: *const c_char, value: i64) -> c_int;
3073 pub fn git_config_set_multivar(
3074 cfg: *mut git_config,
3075 name: *const c_char,
3076 regexp: *const c_char,
3077 value: *const c_char,
3078 ) -> c_int;
3079 pub fn git_config_set_string(
3080 cfg: *mut git_config,
3081 name: *const c_char,
3082 value: *const c_char,
3083 ) -> c_int;
3084 pub fn git_config_snapshot(out: *mut *mut git_config, config: *mut git_config) -> c_int;
3085 pub fn git_config_entry_free(entry: *mut git_config_entry);
3086 pub fn git_config_multivar_iterator_new(
3087 out: *mut *mut git_config_iterator,
3088 cfg: *const git_config,
3089 name: *const c_char,
3090 regexp: *const c_char,
3091 ) -> c_int;
3092
3093 // attr
3094 pub fn git_attr_get(
3095 value_out: *mut *const c_char,
3096 repo: *mut git_repository,
3097 flags: u32,
3098 path: *const c_char,
3099 name: *const c_char,
3100 ) -> c_int;
3101 pub fn git_attr_value(value: *const c_char) -> git_attr_value_t;
3102
3103 // cred
3104 pub fn git_cred_default_new(out: *mut *mut git_cred) -> c_int;
3105 pub fn git_cred_has_username(cred: *mut git_cred) -> c_int;
3106 pub fn git_cred_ssh_custom_new(
3107 out: *mut *mut git_cred,
3108 username: *const c_char,
3109 publickey: *const c_char,
3110 publickey_len: size_t,
3111 sign_callback: git_cred_sign_callback,
3112 payload: *mut c_void,
3113 ) -> c_int;
3114 pub fn git_cred_ssh_interactive_new(
3115 out: *mut *mut git_cred,
3116 username: *const c_char,
3117 prompt_callback: git_cred_ssh_interactive_callback,
3118 payload: *mut c_void,
3119 ) -> c_int;
3120 pub fn git_cred_ssh_key_from_agent(out: *mut *mut git_cred, username: *const c_char) -> c_int;
3121 pub fn git_cred_ssh_key_new(
3122 out: *mut *mut git_cred,
3123 username: *const c_char,
3124 publickey: *const c_char,
3125 privatekey: *const c_char,
3126 passphrase: *const c_char,
3127 ) -> c_int;
3128 pub fn git_cred_ssh_key_memory_new(
3129 out: *mut *mut git_cred,
3130 username: *const c_char,
3131 publickey: *const c_char,
3132 privatekey: *const c_char,
3133 passphrase: *const c_char,
3134 ) -> c_int;
3135 pub fn git_cred_userpass(
3136 cred: *mut *mut git_cred,
3137 url: *const c_char,
3138 user_from_url: *const c_char,
3139 allowed_types: c_uint,
3140 payload: *mut c_void,
3141 ) -> c_int;
3142 pub fn git_cred_userpass_plaintext_new(
3143 out: *mut *mut git_cred,
3144 username: *const c_char,
3145 password: *const c_char,
3146 ) -> c_int;
3147 pub fn git_cred_username_new(cred: *mut *mut git_cred, username: *const c_char) -> c_int;
3148
3149 // tags
3150 pub fn git_tag_annotation_create(
3151 oid: *mut git_oid,
3152 repo: *mut git_repository,
3153 tag_name: *const c_char,
3154 target: *const git_object,
3155 tagger: *const git_signature,
3156 message: *const c_char,
3157 ) -> c_int;
3158 pub fn git_tag_create(
3159 oid: *mut git_oid,
3160 repo: *mut git_repository,
3161 tag_name: *const c_char,
3162 target: *const git_object,
3163 tagger: *const git_signature,
3164 message: *const c_char,
3165 force: c_int,
3166 ) -> c_int;
3167 pub fn git_tag_create_frombuffer(
3168 oid: *mut git_oid,
3169 repo: *mut git_repository,
3170 buffer: *const c_char,
3171 force: c_int,
3172 ) -> c_int;
3173 pub fn git_tag_create_lightweight(
3174 oid: *mut git_oid,
3175 repo: *mut git_repository,
3176 tag_name: *const c_char,
3177 target: *const git_object,
3178 force: c_int,
3179 ) -> c_int;
3180 pub fn git_tag_delete(repo: *mut git_repository, tag_name: *const c_char) -> c_int;
3181 pub fn git_tag_foreach(
3182 repo: *mut git_repository,
3183 callback: git_tag_foreach_cb,
3184 payload: *mut c_void,
3185 ) -> c_int;
3186 pub fn git_tag_free(tag: *mut git_tag);
3187 pub fn git_tag_id(tag: *const git_tag) -> *const git_oid;
3188 pub fn git_tag_list(tag_names: *mut git_strarray, repo: *mut git_repository) -> c_int;
3189 pub fn git_tag_list_match(
3190 tag_names: *mut git_strarray,
3191 pattern: *const c_char,
3192 repo: *mut git_repository,
3193 ) -> c_int;
3194 pub fn git_tag_lookup(
3195 out: *mut *mut git_tag,
3196 repo: *mut git_repository,
3197 id: *const git_oid,
3198 ) -> c_int;
3199 pub fn git_tag_lookup_prefix(
3200 out: *mut *mut git_tag,
3201 repo: *mut git_repository,
3202 id: *const git_oid,
3203 len: size_t,
3204 ) -> c_int;
3205 pub fn git_tag_message(tag: *const git_tag) -> *const c_char;
3206 pub fn git_tag_name(tag: *const git_tag) -> *const c_char;
3207 pub fn git_tag_peel(tag_target_out: *mut *mut git_object, tag: *const git_tag) -> c_int;
3208 pub fn git_tag_tagger(tag: *const git_tag) -> *const git_signature;
3209 pub fn git_tag_target(target_out: *mut *mut git_object, tag: *const git_tag) -> c_int;
3210 pub fn git_tag_target_id(tag: *const git_tag) -> *const git_oid;
3211 pub fn git_tag_target_type(tag: *const git_tag) -> git_object_t;
3212
3213 // checkout
3214 pub fn git_checkout_head(repo: *mut git_repository, opts: *const git_checkout_options)
3215 -> c_int;
3216 pub fn git_checkout_index(
3217 repo: *mut git_repository,
3218 index: *mut git_index,
3219 opts: *const git_checkout_options,
3220 ) -> c_int;
3221 pub fn git_checkout_tree(
3222 repo: *mut git_repository,
3223 treeish: *const git_object,
3224 opts: *const git_checkout_options,
3225 ) -> c_int;
3226 pub fn git_checkout_init_options(opts: *mut git_checkout_options, version: c_uint) -> c_int;
3227
3228 // merge
3229 pub fn git_annotated_commit_id(commit: *const git_annotated_commit) -> *const git_oid;
3230 pub fn git_annotated_commit_ref(commit: *const git_annotated_commit) -> *const c_char;
3231 pub fn git_annotated_commit_from_ref(
3232 out: *mut *mut git_annotated_commit,
3233 repo: *mut git_repository,
3234 reference: *const git_reference,
3235 ) -> c_int;
3236 pub fn git_annotated_commit_from_fetchhead(
3237 out: *mut *mut git_annotated_commit,
3238 repo: *mut git_repository,
3239 branch_name: *const c_char,
3240 remote_url: *const c_char,
3241 oid: *const git_oid,
3242 ) -> c_int;
3243 pub fn git_annotated_commit_free(commit: *mut git_annotated_commit);
3244 pub fn git_merge_init_options(opts: *mut git_merge_options, version: c_uint) -> c_int;
3245 pub fn git_merge(
3246 repo: *mut git_repository,
3247 their_heads: *mut *const git_annotated_commit,
3248 len: size_t,
3249 merge_opts: *const git_merge_options,
3250 checkout_opts: *const git_checkout_options,
3251 ) -> c_int;
3252 pub fn git_merge_commits(
3253 out: *mut *mut git_index,
3254 repo: *mut git_repository,
3255 our_commit: *const git_commit,
3256 their_commit: *const git_commit,
3257 opts: *const git_merge_options,
3258 ) -> c_int;
3259 pub fn git_merge_trees(
3260 out: *mut *mut git_index,
3261 repo: *mut git_repository,
3262 ancestor_tree: *const git_tree,
3263 our_tree: *const git_tree,
3264 their_tree: *const git_tree,
3265 opts: *const git_merge_options,
3266 ) -> c_int;
3267 pub fn git_repository_state_cleanup(repo: *mut git_repository) -> c_int;
3268
3269 // merge analysis
3270
3271 pub fn git_merge_analysis(
3272 analysis_out: *mut git_merge_analysis_t,
3273 pref_out: *mut git_merge_preference_t,
3274 repo: *mut git_repository,
3275 their_heads: *mut *const git_annotated_commit,
3276 their_heads_len: usize,
3277 ) -> c_int;
3278
3279 pub fn git_merge_analysis_for_ref(
3280 analysis_out: *mut git_merge_analysis_t,
3281 pref_out: *mut git_merge_preference_t,
3282 repo: *mut git_repository,
3283 git_reference: *mut git_reference,
3284 their_heads: *mut *const git_annotated_commit,
3285 their_heads_len: usize,
3286 ) -> c_int;
3287
3288 // notes
3289 pub fn git_note_author(note: *const git_note) -> *const git_signature;
3290 pub fn git_note_committer(note: *const git_note) -> *const git_signature;
3291 pub fn git_note_create(
3292 out: *mut git_oid,
3293 repo: *mut git_repository,
3294 notes_ref: *const c_char,
3295 author: *const git_signature,
3296 committer: *const git_signature,
3297 oid: *const git_oid,
3298 note: *const c_char,
3299 force: c_int,
3300 ) -> c_int;
3301 pub fn git_note_default_ref(out: *mut git_buf, repo: *mut git_repository) -> c_int;
3302 pub fn git_note_free(note: *mut git_note);
3303 pub fn git_note_id(note: *const git_note) -> *const git_oid;
3304 pub fn git_note_iterator_free(it: *mut git_note_iterator);
3305 pub fn git_note_iterator_new(
3306 out: *mut *mut git_note_iterator,
3307 repo: *mut git_repository,
3308 notes_ref: *const c_char,
3309 ) -> c_int;
3310 pub fn git_note_message(note: *const git_note) -> *const c_char;
3311 pub fn git_note_next(
3312 note_id: *mut git_oid,
3313 annotated_id: *mut git_oid,
3314 it: *mut git_note_iterator,
3315 ) -> c_int;
3316 pub fn git_note_read(
3317 out: *mut *mut git_note,
3318 repo: *mut git_repository,
3319 notes_ref: *const c_char,
3320 oid: *const git_oid,
3321 ) -> c_int;
3322 pub fn git_note_remove(
3323 repo: *mut git_repository,
3324 notes_ref: *const c_char,
3325 author: *const git_signature,
3326 committer: *const git_signature,
3327 oid: *const git_oid,
3328 ) -> c_int;
3329
3330 // blame
3331 pub fn git_blame_file(
3332 out: *mut *mut git_blame,
3333 repo: *mut git_repository,
3334 path: *const c_char,
3335 options: *mut git_blame_options,
3336 ) -> c_int;
3337 pub fn git_blame_free(blame: *mut git_blame);
3338
3339 pub fn git_blame_init_options(opts: *mut git_blame_options, version: c_uint) -> c_int;
3340 pub fn git_blame_get_hunk_count(blame: *mut git_blame) -> u32;
3341
3342 pub fn git_blame_get_hunk_byline(blame: *mut git_blame, lineno: usize)
3343 -> *const git_blame_hunk;
3344 pub fn git_blame_get_hunk_byindex(blame: *mut git_blame, index: u32) -> *const git_blame_hunk;
3345
3346 // revwalk
3347 pub fn git_revwalk_new(out: *mut *mut git_revwalk, repo: *mut git_repository) -> c_int;
3348 pub fn git_revwalk_free(walk: *mut git_revwalk);
3349
3350 pub fn git_revwalk_reset(walk: *mut git_revwalk) -> c_int;
3351
3352 pub fn git_revwalk_sorting(walk: *mut git_revwalk, sort_mode: c_uint) -> c_int;
3353
3354 pub fn git_revwalk_push_head(walk: *mut git_revwalk) -> c_int;
3355 pub fn git_revwalk_push(walk: *mut git_revwalk, oid: *const git_oid) -> c_int;
3356 pub fn git_revwalk_push_ref(walk: *mut git_revwalk, refname: *const c_char) -> c_int;
3357 pub fn git_revwalk_push_glob(walk: *mut git_revwalk, glob: *const c_char) -> c_int;
3358 pub fn git_revwalk_push_range(walk: *mut git_revwalk, range: *const c_char) -> c_int;
3359 pub fn git_revwalk_simplify_first_parent(walk: *mut git_revwalk) -> c_int;
3360
3361 pub fn git_revwalk_hide_head(walk: *mut git_revwalk) -> c_int;
3362 pub fn git_revwalk_hide(walk: *mut git_revwalk, oid: *const git_oid) -> c_int;
3363 pub fn git_revwalk_hide_ref(walk: *mut git_revwalk, refname: *const c_char) -> c_int;
3364 pub fn git_revwalk_hide_glob(walk: *mut git_revwalk, refname: *const c_char) -> c_int;
3365 pub fn git_revwalk_add_hide_cb(
3366 walk: *mut git_revwalk,
3367 hide_cb: git_revwalk_hide_cb,
3368 payload: *mut c_void,
3369 ) -> c_int;
3370
3371 pub fn git_revwalk_next(out: *mut git_oid, walk: *mut git_revwalk) -> c_int;
3372
3373 // merge
3374 pub fn git_merge_base(
3375 out: *mut git_oid,
3376 repo: *mut git_repository,
3377 one: *const git_oid,
3378 two: *const git_oid,
3379 ) -> c_int;
3380
3381 pub fn git_merge_base_many(
3382 out: *mut git_oid,
3383 repo: *mut git_repository,
3384 length: size_t,
3385 input_array: *const git_oid,
3386 ) -> c_int;
3387
3388 pub fn git_merge_bases(
3389 out: *mut git_oidarray,
3390 repo: *mut git_repository,
3391 one: *const git_oid,
3392 two: *const git_oid,
3393 ) -> c_int;
3394
3395 pub fn git_merge_bases_many(
3396 out: *mut git_oidarray,
3397 repo: *mut git_repository,
3398 length: size_t,
3399 input_array: *const git_oid,
3400 ) -> c_int;
3401
3402 // pathspec
3403 pub fn git_pathspec_free(ps: *mut git_pathspec);
3404 pub fn git_pathspec_match_diff(
3405 out: *mut *mut git_pathspec_match_list,
3406 diff: *mut git_diff,
3407 flags: u32,
3408 ps: *mut git_pathspec,
3409 ) -> c_int;
3410 pub fn git_pathspec_match_index(
3411 out: *mut *mut git_pathspec_match_list,
3412 index: *mut git_index,
3413 flags: u32,
3414 ps: *mut git_pathspec,
3415 ) -> c_int;
3416 pub fn git_pathspec_match_list_diff_entry(
3417 m: *const git_pathspec_match_list,
3418 pos: size_t,
3419 ) -> *const git_diff_delta;
3420 pub fn git_pathspec_match_list_entry(
3421 m: *const git_pathspec_match_list,
3422 pos: size_t,
3423 ) -> *const c_char;
3424 pub fn git_pathspec_match_list_entrycount(m: *const git_pathspec_match_list) -> size_t;
3425 pub fn git_pathspec_match_list_failed_entry(
3426 m: *const git_pathspec_match_list,
3427 pos: size_t,
3428 ) -> *const c_char;
3429 pub fn git_pathspec_match_list_failed_entrycount(m: *const git_pathspec_match_list) -> size_t;
3430 pub fn git_pathspec_match_list_free(m: *mut git_pathspec_match_list);
3431 pub fn git_pathspec_match_tree(
3432 out: *mut *mut git_pathspec_match_list,
3433 tree: *mut git_tree,
3434 flags: u32,
3435 ps: *mut git_pathspec,
3436 ) -> c_int;
3437 pub fn git_pathspec_match_workdir(
3438 out: *mut *mut git_pathspec_match_list,
3439 repo: *mut git_repository,
3440 flags: u32,
3441 ps: *mut git_pathspec,
3442 ) -> c_int;
3443 pub fn git_pathspec_matches_path(
3444 ps: *const git_pathspec,
3445 flags: u32,
3446 path: *const c_char,
3447 ) -> c_int;
3448 pub fn git_pathspec_new(out: *mut *mut git_pathspec, pathspec: *const git_strarray) -> c_int;
3449
3450 // diff
3451 pub fn git_diff_blob_to_buffer(
3452 old_blob: *const git_blob,
3453 old_as_path: *const c_char,
3454 buffer: *const c_char,
3455 buffer_len: size_t,
3456 buffer_as_path: *const c_char,
3457 options: *const git_diff_options,
3458 file_cb: git_diff_file_cb,
3459 binary_cb: git_diff_binary_cb,
3460 hunk_cb: git_diff_hunk_cb,
3461 line_cb: git_diff_line_cb,
3462 payload: *mut c_void,
3463 ) -> c_int;
3464 pub fn git_diff_blobs(
3465 old_blob: *const git_blob,
3466 old_as_path: *const c_char,
3467 new_blob: *const git_blob,
3468 new_as_path: *const c_char,
3469 options: *const git_diff_options,
3470 file_cb: git_diff_file_cb,
3471 binary_cb: git_diff_binary_cb,
3472 hunk_cb: git_diff_hunk_cb,
3473 line_cb: git_diff_line_cb,
3474 payload: *mut c_void,
3475 ) -> c_int;
3476 pub fn git_diff_buffers(
3477 old_buffer: *const c_void,
3478 old_len: size_t,
3479 old_as_path: *const c_char,
3480 new_buffer: *const c_void,
3481 new_len: size_t,
3482 new_as_path: *const c_char,
3483 options: *const git_diff_options,
3484 file_cb: git_diff_file_cb,
3485 binary_cb: git_diff_binary_cb,
3486 hunk_cb: git_diff_hunk_cb,
3487 line_cb: git_diff_line_cb,
3488 payload: *mut c_void,
3489 ) -> c_int;
3490 pub fn git_diff_from_buffer(
3491 diff: *mut *mut git_diff,
3492 content: *const c_char,
3493 content_len: size_t,
3494 ) -> c_int;
3495 pub fn git_diff_find_similar(
3496 diff: *mut git_diff,
3497 options: *const git_diff_find_options,
3498 ) -> c_int;
3499 pub fn git_diff_find_init_options(opts: *mut git_diff_find_options, version: c_uint) -> c_int;
3500 pub fn git_diff_foreach(
3501 diff: *mut git_diff,
3502 file_cb: git_diff_file_cb,
3503 binary_cb: git_diff_binary_cb,
3504 hunk_cb: git_diff_hunk_cb,
3505 line_cb: git_diff_line_cb,
3506 payload: *mut c_void,
3507 ) -> c_int;
3508 pub fn git_diff_free(diff: *mut git_diff);
3509 pub fn git_diff_get_delta(diff: *const git_diff, idx: size_t) -> *const git_diff_delta;
3510 pub fn git_diff_get_stats(out: *mut *mut git_diff_stats, diff: *mut git_diff) -> c_int;
3511 pub fn git_diff_index_to_index(
3512 diff: *mut *mut git_diff,
3513 repo: *mut git_repository,
3514 old_index: *mut git_index,
3515 new_index: *mut git_index,
3516 opts: *const git_diff_options,
3517 ) -> c_int;
3518 pub fn git_diff_index_to_workdir(
3519 diff: *mut *mut git_diff,
3520 repo: *mut git_repository,
3521 index: *mut git_index,
3522 opts: *const git_diff_options,
3523 ) -> c_int;
3524 pub fn git_diff_init_options(opts: *mut git_diff_options, version: c_uint) -> c_int;
3525 pub fn git_diff_is_sorted_icase(diff: *const git_diff) -> c_int;
3526 pub fn git_diff_merge(onto: *mut git_diff, from: *const git_diff) -> c_int;
3527 pub fn git_diff_num_deltas(diff: *const git_diff) -> size_t;
3528 pub fn git_diff_num_deltas_of_type(diff: *const git_diff, delta: git_delta_t) -> size_t;
3529 pub fn git_diff_print(
3530 diff: *mut git_diff,
3531 format: git_diff_format_t,
3532 print_cb: git_diff_line_cb,
3533 payload: *mut c_void,
3534 ) -> c_int;
3535 pub fn git_diff_stats_deletions(stats: *const git_diff_stats) -> size_t;
3536 pub fn git_diff_stats_files_changed(stats: *const git_diff_stats) -> size_t;
3537 pub fn git_diff_stats_free(stats: *mut git_diff_stats);
3538 pub fn git_diff_stats_insertions(stats: *const git_diff_stats) -> size_t;
3539 pub fn git_diff_stats_to_buf(
3540 out: *mut git_buf,
3541 stats: *const git_diff_stats,
3542 format: git_diff_stats_format_t,
3543 width: size_t,
3544 ) -> c_int;
3545 pub fn git_diff_status_char(status: git_delta_t) -> c_char;
3546 pub fn git_diff_tree_to_index(
3547 diff: *mut *mut git_diff,
3548 repo: *mut git_repository,
3549 old_tree: *mut git_tree,
3550 index: *mut git_index,
3551 opts: *const git_diff_options,
3552 ) -> c_int;
3553 pub fn git_diff_tree_to_tree(
3554 diff: *mut *mut git_diff,
3555 repo: *mut git_repository,
3556 old_tree: *mut git_tree,
3557 new_tree: *mut git_tree,
3558 opts: *const git_diff_options,
3559 ) -> c_int;
3560 pub fn git_diff_tree_to_workdir(
3561 diff: *mut *mut git_diff,
3562 repo: *mut git_repository,
3563 old_tree: *mut git_tree,
3564 opts: *const git_diff_options,
3565 ) -> c_int;
3566 pub fn git_diff_tree_to_workdir_with_index(
3567 diff: *mut *mut git_diff,
3568 repo: *mut git_repository,
3569 old_tree: *mut git_tree,
3570 opts: *const git_diff_options,
3571 ) -> c_int;
3572
3573 pub fn git_graph_ahead_behind(
3574 ahead: *mut size_t,
3575 behind: *mut size_t,
3576 repo: *mut git_repository,
3577 local: *const git_oid,
3578 upstream: *const git_oid,
3579 ) -> c_int;
3580
3581 pub fn git_graph_descendant_of(
3582 repo: *mut git_repository,
3583 commit: *const git_oid,
3584 ancestor: *const git_oid,
3585 ) -> c_int;
3586
3587 pub fn git_diff_format_email(
3588 out: *mut git_buf,
3589 diff: *mut git_diff,
3590 opts: *const git_diff_format_email_options,
3591 ) -> c_int;
3592 pub fn git_diff_format_email_options_init(
3593 opts: *mut git_diff_format_email_options,
3594 version: c_uint,
3595 ) -> c_int;
3596
3597 pub fn git_diff_patchid(
3598 out: *mut git_oid,
3599 diff: *mut git_diff,
3600 opts: *mut git_diff_patchid_options,
3601 ) -> c_int;
3602 pub fn git_diff_patchid_options_init(
3603 opts: *mut git_diff_patchid_options,
3604 version: c_uint,
3605 ) -> c_int;
3606
3607 // patch
3608 pub fn git_patch_from_diff(out: *mut *mut git_patch, diff: *mut git_diff, idx: size_t)
3609 -> c_int;
3610 pub fn git_patch_from_blobs(
3611 out: *mut *mut git_patch,
3612 old_blob: *const git_blob,
3613 old_as_path: *const c_char,
3614 new_blob: *const git_blob,
3615 new_as_path: *const c_char,
3616 opts: *const git_diff_options,
3617 ) -> c_int;
3618 pub fn git_patch_from_blob_and_buffer(
3619 out: *mut *mut git_patch,
3620 old_blob: *const git_blob,
3621 old_as_path: *const c_char,
3622 buffer: *const c_void,
3623 buffer_len: size_t,
3624 buffer_as_path: *const c_char,
3625 opts: *const git_diff_options,
3626 ) -> c_int;
3627 pub fn git_patch_from_buffers(
3628 out: *mut *mut git_patch,
3629 old_buffer: *const c_void,
3630 old_len: size_t,
3631 old_as_path: *const c_char,
3632 new_buffer: *const c_void,
3633 new_len: size_t,
3634 new_as_path: *const c_char,
3635 opts: *const git_diff_options,
3636 ) -> c_int;
3637 pub fn git_patch_free(patch: *mut git_patch);
3638 pub fn git_patch_get_delta(patch: *const git_patch) -> *const git_diff_delta;
3639 pub fn git_patch_num_hunks(patch: *const git_patch) -> size_t;
3640 pub fn git_patch_line_stats(
3641 total_context: *mut size_t,
3642 total_additions: *mut size_t,
3643 total_deletions: *mut size_t,
3644 patch: *const git_patch,
3645 ) -> c_int;
3646 pub fn git_patch_get_hunk(
3647 out: *mut *const git_diff_hunk,
3648 lines_in_hunk: *mut size_t,
3649 patch: *mut git_patch,
3650 hunk_idx: size_t,
3651 ) -> c_int;
3652 pub fn git_patch_num_lines_in_hunk(patch: *const git_patch, hunk_idx: size_t) -> c_int;
3653 pub fn git_patch_get_line_in_hunk(
3654 out: *mut *const git_diff_line,
3655 patch: *mut git_patch,
3656 hunk_idx: size_t,
3657 line_of_hunk: size_t,
3658 ) -> c_int;
3659 pub fn git_patch_size(
3660 patch: *mut git_patch,
3661 include_context: c_int,
3662 include_hunk_headers: c_int,
3663 include_file_headers: c_int,
3664 ) -> size_t;
3665 pub fn git_patch_print(
3666 patch: *mut git_patch,
3667 print_cb: git_diff_line_cb,
3668 payload: *mut c_void,
3669 ) -> c_int;
3670 pub fn git_patch_to_buf(buf: *mut git_buf, patch: *mut git_patch) -> c_int;
3671
3672 // reflog
3673 pub fn git_reflog_append(
3674 reflog: *mut git_reflog,
3675 id: *const git_oid,
3676 committer: *const git_signature,
3677 msg: *const c_char,
3678 ) -> c_int;
3679 pub fn git_reflog_delete(repo: *mut git_repository, name: *const c_char) -> c_int;
3680 pub fn git_reflog_drop(
3681 reflog: *mut git_reflog,
3682 idx: size_t,
3683 rewrite_previous_entry: c_int,
3684 ) -> c_int;
3685 pub fn git_reflog_entry_byindex(
3686 reflog: *const git_reflog,
3687 idx: size_t,
3688 ) -> *const git_reflog_entry;
3689 pub fn git_reflog_entry_committer(entry: *const git_reflog_entry) -> *const git_signature;
3690 pub fn git_reflog_entry_id_new(entry: *const git_reflog_entry) -> *const git_oid;
3691 pub fn git_reflog_entry_id_old(entry: *const git_reflog_entry) -> *const git_oid;
3692 pub fn git_reflog_entry_message(entry: *const git_reflog_entry) -> *const c_char;
3693 pub fn git_reflog_entrycount(reflog: *mut git_reflog) -> size_t;
3694 pub fn git_reflog_free(reflog: *mut git_reflog);
3695 pub fn git_reflog_read(
3696 out: *mut *mut git_reflog,
3697 repo: *mut git_repository,
3698 name: *const c_char,
3699 ) -> c_int;
3700 pub fn git_reflog_rename(
3701 repo: *mut git_repository,
3702 old_name: *const c_char,
3703 name: *const c_char,
3704 ) -> c_int;
3705 pub fn git_reflog_write(reflog: *mut git_reflog) -> c_int;
3706
3707 // transport
3708 pub fn git_transport_register(
3709 prefix: *const c_char,
3710 cb: git_transport_cb,
3711 param: *mut c_void,
3712 ) -> c_int;
3713 pub fn git_transport_unregister(prefix: *const c_char) -> c_int;
3714 pub fn git_transport_smart(
3715 out: *mut *mut git_transport,
3716 owner: *mut git_remote,
3717 payload: *mut c_void,
3718 ) -> c_int;
3719
3720 // describe
3721 pub fn git_describe_commit(
3722 result: *mut *mut git_describe_result,
3723 object: *mut git_object,
3724 opts: *mut git_describe_options,
3725 ) -> c_int;
3726 pub fn git_describe_format(
3727 buf: *mut git_buf,
3728 result: *const git_describe_result,
3729 opts: *const git_describe_format_options,
3730 ) -> c_int;
3731 pub fn git_describe_result_free(result: *mut git_describe_result);
3732 pub fn git_describe_workdir(
3733 out: *mut *mut git_describe_result,
3734 repo: *mut git_repository,
3735 opts: *mut git_describe_options,
3736 ) -> c_int;
3737
3738 // message
3739 pub fn git_message_prettify(
3740 out: *mut git_buf,
3741 message: *const c_char,
3742 strip_comments: c_int,
3743 comment_char: c_char,
3744 ) -> c_int;
3745
3746 pub fn git_message_trailers(
3747 out: *mut git_message_trailer_array,
3748 message: *const c_char,
3749 ) -> c_int;
3750
3751 pub fn git_message_trailer_array_free(trailer: *mut git_message_trailer_array);
3752
3753 // packbuilder
3754 pub fn git_packbuilder_new(out: *mut *mut git_packbuilder, repo: *mut git_repository) -> c_int;
3755 pub fn git_packbuilder_set_threads(pb: *mut git_packbuilder, n: c_uint) -> c_uint;
3756 pub fn git_packbuilder_insert(
3757 pb: *mut git_packbuilder,
3758 id: *const git_oid,
3759 name: *const c_char,
3760 ) -> c_int;
3761 pub fn git_packbuilder_insert_tree(pb: *mut git_packbuilder, id: *const git_oid) -> c_int;
3762 pub fn git_packbuilder_insert_commit(pb: *mut git_packbuilder, id: *const git_oid) -> c_int;
3763 pub fn git_packbuilder_insert_walk(pb: *mut git_packbuilder, walk: *mut git_revwalk) -> c_int;
3764 pub fn git_packbuilder_insert_recur(
3765 pb: *mut git_packbuilder,
3766 id: *const git_oid,
3767 name: *const c_char,
3768 ) -> c_int;
3769 pub fn git_packbuilder_write_buf(buf: *mut git_buf, pb: *mut git_packbuilder) -> c_int;
3770 pub fn git_packbuilder_write(
3771 pb: *mut git_packbuilder,
3772 path: *const c_char,
3773 mode: c_uint,
3774 progress_cb: git_indexer_progress_cb,
3775 progress_cb_payload: *mut c_void,
3776 ) -> c_int;
3777 #[deprecated = "use `git_packbuilder_name` to retrieve the filename"]
3778 pub fn git_packbuilder_hash(pb: *mut git_packbuilder) -> *const git_oid;
3779 pub fn git_packbuilder_name(pb: *mut git_packbuilder) -> *const c_char;
3780 pub fn git_packbuilder_foreach(
3781 pb: *mut git_packbuilder,
3782 cb: git_packbuilder_foreach_cb,
3783 payload: *mut c_void,
3784 ) -> c_int;
3785 pub fn git_packbuilder_object_count(pb: *mut git_packbuilder) -> size_t;
3786 pub fn git_packbuilder_written(pb: *mut git_packbuilder) -> size_t;
3787 pub fn git_packbuilder_set_callbacks(
3788 pb: *mut git_packbuilder,
3789 progress_cb: git_packbuilder_progress,
3790 progress_cb_payload: *mut c_void,
3791 ) -> c_int;
3792 pub fn git_packbuilder_free(pb: *mut git_packbuilder);
3793
3794 // odb
3795 pub fn git_repository_odb(out: *mut *mut git_odb, repo: *mut git_repository) -> c_int;
3796 pub fn git_odb_new(db: *mut *mut git_odb) -> c_int;
3797 pub fn git_odb_free(db: *mut git_odb);
3798 pub fn git_odb_open_rstream(
3799 out: *mut *mut git_odb_stream,
3800 len: *mut size_t,
3801 otype: *mut git_object_t,
3802 db: *mut git_odb,
3803 oid: *const git_oid,
3804 ) -> c_int;
3805 pub fn git_odb_stream_read(
3806 stream: *mut git_odb_stream,
3807 buffer: *mut c_char,
3808 len: size_t,
3809 ) -> c_int;
3810 pub fn git_odb_open_wstream(
3811 out: *mut *mut git_odb_stream,
3812 db: *mut git_odb,
3813 size: git_object_size_t,
3814 obj_type: git_object_t,
3815 ) -> c_int;
3816 pub fn git_odb_stream_write(
3817 stream: *mut git_odb_stream,
3818 buffer: *const c_char,
3819 len: size_t,
3820 ) -> c_int;
3821 pub fn git_odb_stream_finalize_write(id: *mut git_oid, stream: *mut git_odb_stream) -> c_int;
3822 pub fn git_odb_stream_free(stream: *mut git_odb_stream);
3823 pub fn git_odb_foreach(db: *mut git_odb, cb: git_odb_foreach_cb, payload: *mut c_void)
3824 -> c_int;
3825
3826 pub fn git_odb_read(
3827 out: *mut *mut git_odb_object,
3828 odb: *mut git_odb,
3829 oid: *const git_oid,
3830 ) -> c_int;
3831
3832 pub fn git_odb_read_header(
3833 len_out: *mut size_t,
3834 type_out: *mut git_object_t,
3835 odb: *mut git_odb,
3836 oid: *const git_oid,
3837 ) -> c_int;
3838
3839 pub fn git_odb_write(
3840 out: *mut git_oid,
3841 odb: *mut git_odb,
3842 data: *const c_void,
3843 len: size_t,
3844 otype: git_object_t,
3845 ) -> c_int;
3846
3847 pub fn git_odb_write_pack(
3848 out: *mut *mut git_odb_writepack,
3849 odb: *mut git_odb,
3850 progress_cb: git_indexer_progress_cb,
3851 progress_payload: *mut c_void,
3852 ) -> c_int;
3853
3854 pub fn git_odb_hash(
3855 out: *mut git_oid,
3856 data: *const c_void,
3857 len: size_t,
3858 otype: git_object_t,
3859 ) -> c_int;
3860
3861 pub fn git_odb_hashfile(out: *mut git_oid, path: *const c_char, otype: git_object_t) -> c_int;
3862
3863 pub fn git_odb_exists_prefix(
3864 out: *mut git_oid,
3865 odb: *mut git_odb,
3866 short_oid: *const git_oid,
3867 len: size_t,
3868 ) -> c_int;
3869
3870 pub fn git_odb_exists(odb: *mut git_odb, oid: *const git_oid) -> c_int;
3871 pub fn git_odb_exists_ext(odb: *mut git_odb, oid: *const git_oid, flags: c_uint) -> c_int;
3872
3873 pub fn git_odb_refresh(odb: *mut git_odb) -> c_int;
3874
3875 pub fn git_odb_object_id(obj: *mut git_odb_object) -> *const git_oid;
3876 pub fn git_odb_object_size(obj: *mut git_odb_object) -> size_t;
3877 pub fn git_odb_object_type(obj: *mut git_odb_object) -> git_object_t;
3878 pub fn git_odb_object_data(obj: *mut git_odb_object) -> *const c_void;
3879 pub fn git_odb_object_dup(out: *mut *mut git_odb_object, obj: *mut git_odb_object) -> c_int;
3880 pub fn git_odb_object_free(obj: *mut git_odb_object);
3881
3882 pub fn git_odb_init_backend(odb: *mut git_odb_backend, version: c_uint) -> c_int;
3883
3884 pub fn git_odb_add_backend(
3885 odb: *mut git_odb,
3886 backend: *mut git_odb_backend,
3887 priority: c_int,
3888 ) -> c_int;
3889
3890 pub fn git_odb_backend_pack(
3891 out: *mut *mut git_odb_backend,
3892 objects_dir: *const c_char,
3893 ) -> c_int;
3894
3895 pub fn git_odb_backend_one_pack(
3896 out: *mut *mut git_odb_backend,
3897 objects_dir: *const c_char,
3898 ) -> c_int;
3899
3900 pub fn git_odb_add_disk_alternate(odb: *mut git_odb, path: *const c_char) -> c_int;
3901
3902 pub fn git_odb_backend_loose(
3903 out: *mut *mut git_odb_backend,
3904 objects_dir: *const c_char,
3905 compression_level: c_int,
3906 do_fsync: c_int,
3907 dir_mode: c_uint,
3908 file_mode: c_uint,
3909 ) -> c_int;
3910
3911 pub fn git_odb_add_alternate(
3912 odb: *mut git_odb,
3913 backend: *mut git_odb_backend,
3914 priority: c_int,
3915 ) -> c_int;
3916
3917 pub fn git_odb_backend_malloc(backend: *mut git_odb_backend, len: size_t) -> *mut c_void;
3918
3919 pub fn git_odb_num_backends(odb: *mut git_odb) -> size_t;
3920 pub fn git_odb_get_backend(
3921 backend: *mut *mut git_odb_backend,
3922 odb: *mut git_odb,
3923 position: size_t,
3924 ) -> c_int;
3925
3926 // mempack
3927 pub fn git_mempack_new(out: *mut *mut git_odb_backend) -> c_int;
3928 pub fn git_mempack_reset(backend: *mut git_odb_backend) -> c_int;
3929 pub fn git_mempack_dump(
3930 pack: *mut git_buf,
3931 repo: *mut git_repository,
3932 backend: *mut git_odb_backend,
3933 ) -> c_int;
3934
3935 // refdb
3936 pub fn git_refdb_new(out: *mut *mut git_refdb, repo: *mut git_repository) -> c_int;
3937 pub fn git_refdb_open(out: *mut *mut git_refdb, repo: *mut git_repository) -> c_int;
3938 pub fn git_refdb_backend_fs(
3939 out: *mut *mut git_refdb_backend,
3940 repo: *mut git_repository,
3941 ) -> c_int;
3942 pub fn git_refdb_init_backend(backend: *mut git_refdb_backend, version: c_uint) -> c_int;
3943 pub fn git_refdb_set_backend(refdb: *mut git_refdb, backend: *mut git_refdb_backend) -> c_int;
3944 pub fn git_refdb_compress(refdb: *mut git_refdb) -> c_int;
3945 pub fn git_refdb_free(refdb: *mut git_refdb);
3946
3947 // rebase
3948 pub fn git_rebase_init_options(opts: *mut git_rebase_options, version: c_uint) -> c_int;
3949 pub fn git_rebase_init(
3950 out: *mut *mut git_rebase,
3951 repo: *mut git_repository,
3952 branch: *const git_annotated_commit,
3953 upstream: *const git_annotated_commit,
3954 onto: *const git_annotated_commit,
3955 opts: *const git_rebase_options,
3956 ) -> c_int;
3957 pub fn git_rebase_open(
3958 out: *mut *mut git_rebase,
3959 repo: *mut git_repository,
3960 opts: *const git_rebase_options,
3961 ) -> c_int;
3962 pub fn git_rebase_operation_entrycount(rebase: *mut git_rebase) -> size_t;
3963 pub fn git_rebase_operation_current(rebase: *mut git_rebase) -> size_t;
3964 pub fn git_rebase_operation_byindex(
3965 rebase: *mut git_rebase,
3966 idx: size_t,
3967 ) -> *mut git_rebase_operation;
3968 pub fn git_rebase_orig_head_id(rebase: *mut git_rebase) -> *const git_oid;
3969 pub fn git_rebase_orig_head_name(rebase: *mut git_rebase) -> *const c_char;
3970 pub fn git_rebase_next(
3971 operation: *mut *mut git_rebase_operation,
3972 rebase: *mut git_rebase,
3973 ) -> c_int;
3974 pub fn git_rebase_inmemory_index(index: *mut *mut git_index, rebase: *mut git_rebase) -> c_int;
3975 pub fn git_rebase_commit(
3976 id: *mut git_oid,
3977 rebase: *mut git_rebase,
3978 author: *const git_signature,
3979 committer: *const git_signature,
3980 message_encoding: *const c_char,
3981 message: *const c_char,
3982 ) -> c_int;
3983 pub fn git_rebase_abort(rebase: *mut git_rebase) -> c_int;
3984 pub fn git_rebase_finish(rebase: *mut git_rebase, signature: *const git_signature) -> c_int;
3985 pub fn git_rebase_free(rebase: *mut git_rebase);
3986
3987 // cherrypick
3988 pub fn git_cherrypick_init_options(opts: *mut git_cherrypick_options, version: c_uint)
3989 -> c_int;
3990 pub fn git_cherrypick(
3991 repo: *mut git_repository,
3992 commit: *mut git_commit,
3993 options: *const git_cherrypick_options,
3994 ) -> c_int;
3995 pub fn git_cherrypick_commit(
3996 out: *mut *mut git_index,
3997 repo: *mut git_repository,
3998 cherrypick_commit: *mut git_commit,
3999 our_commit: *mut git_commit,
4000 mainline: c_uint,
4001 merge_options: *const git_merge_options,
4002 ) -> c_int;
4003
4004 // apply
4005 pub fn git_apply_options_init(opts: *mut git_apply_options, version: c_uint) -> c_int;
4006 pub fn git_apply_to_tree(
4007 out: *mut *mut git_index,
4008 repo: *mut git_repository,
4009 preimage: *mut git_tree,
4010 diff: *mut git_diff,
4011 options: *const git_apply_options,
4012 ) -> c_int;
4013 pub fn git_apply(
4014 repo: *mut git_repository,
4015 diff: *mut git_diff,
4016 location: git_apply_location_t,
4017 options: *const git_apply_options,
4018 ) -> c_int;
4019
4020 // revert
4021 pub fn git_revert_options_init(opts: *mut git_revert_options, version: c_uint) -> c_int;
4022 pub fn git_revert_commit(
4023 out: *mut *mut git_index,
4024 repo: *mut git_repository,
4025 revert_commit: *mut git_commit,
4026 our_commit: *mut git_commit,
4027 mainline: c_uint,
4028 merge_options: *const git_merge_options,
4029 ) -> c_int;
4030 pub fn git_revert(
4031 repo: *mut git_repository,
4032 commit: *mut git_commit,
4033 given_opts: *const git_revert_options,
4034 ) -> c_int;
4035
4036 // Common
4037 pub fn git_libgit2_version(major: *mut c_int, minor: *mut c_int, rev: *mut c_int) -> c_int;
4038 pub fn git_libgit2_features() -> c_int;
4039 pub fn git_libgit2_opts(option: c_int, ...) -> c_int;
4040
4041 // Worktrees
4042 pub fn git_worktree_list(out: *mut git_strarray, repo: *mut git_repository) -> c_int;
4043 pub fn git_worktree_lookup(
4044 out: *mut *mut git_worktree,
4045 repo: *mut git_repository,
4046 name: *const c_char,
4047 ) -> c_int;
4048 pub fn git_worktree_open_from_repository(
4049 out: *mut *mut git_worktree,
4050 repo: *mut git_repository,
4051 ) -> c_int;
4052 pub fn git_worktree_free(wt: *mut git_worktree);
4053 pub fn git_worktree_validate(wt: *const git_worktree) -> c_int;
4054 pub fn git_worktree_add_options_init(
4055 opts: *mut git_worktree_add_options,
4056 version: c_uint,
4057 ) -> c_int;
4058 pub fn git_worktree_add(
4059 out: *mut *mut git_worktree,
4060 repo: *mut git_repository,
4061 name: *const c_char,
4062 path: *const c_char,
4063 opts: *const git_worktree_add_options,
4064 ) -> c_int;
4065 pub fn git_worktree_lock(wt: *mut git_worktree, reason: *const c_char) -> c_int;
4066 pub fn git_worktree_unlock(wt: *mut git_worktree) -> c_int;
4067 pub fn git_worktree_is_locked(reason: *mut git_buf, wt: *const git_worktree) -> c_int;
4068 pub fn git_worktree_name(wt: *const git_worktree) -> *const c_char;
4069 pub fn git_worktree_path(wt: *const git_worktree) -> *const c_char;
4070 pub fn git_worktree_prune_options_init(
4071 opts: *mut git_worktree_prune_options,
4072 version: c_uint,
4073 ) -> c_int;
4074 pub fn git_worktree_is_prunable(
4075 wt: *mut git_worktree,
4076 opts: *mut git_worktree_prune_options,
4077 ) -> c_int;
4078 pub fn git_worktree_prune(
4079 wt: *mut git_worktree,
4080 opts: *mut git_worktree_prune_options,
4081 ) -> c_int;
4082
4083 // Ref transactions
4084 pub fn git_transaction_new(out: *mut *mut git_transaction, repo: *mut git_repository) -> c_int;
4085 pub fn git_transaction_lock_ref(tx: *mut git_transaction, refname: *const c_char) -> c_int;
4086 pub fn git_transaction_set_target(
4087 tx: *mut git_transaction,
4088 refname: *const c_char,
4089 target: *const git_oid,
4090 sig: *const git_signature,
4091 msg: *const c_char,
4092 ) -> c_int;
4093 pub fn git_transaction_set_symbolic_target(
4094 tx: *mut git_transaction,
4095 refname: *const c_char,
4096 target: *const c_char,
4097 sig: *const git_signature,
4098 msg: *const c_char,
4099 ) -> c_int;
4100 pub fn git_transaction_set_reflog(
4101 tx: *mut git_transaction,
4102 refname: *const c_char,
4103 reflog: *const git_reflog,
4104 ) -> c_int;
4105 pub fn git_transaction_remove(tx: *mut git_transaction, refname: *const c_char) -> c_int;
4106 pub fn git_transaction_commit(tx: *mut git_transaction) -> c_int;
4107 pub fn git_transaction_free(tx: *mut git_transaction);
4108
4109 // Mailmap
4110 pub fn git_mailmap_new(out: *mut *mut git_mailmap) -> c_int;
4111 pub fn git_mailmap_from_buffer(
4112 out: *mut *mut git_mailmap,
4113 buf: *const c_char,
4114 len: size_t,
4115 ) -> c_int;
4116 pub fn git_mailmap_from_repository(
4117 out: *mut *mut git_mailmap,
4118 repo: *mut git_repository,
4119 ) -> c_int;
4120 pub fn git_mailmap_free(mm: *mut git_mailmap);
4121 pub fn git_mailmap_resolve_signature(
4122 out: *mut *mut git_signature,
4123 mm: *const git_mailmap,
4124 sig: *const git_signature,
4125 ) -> c_int;
4126 pub fn git_mailmap_add_entry(
4127 mm: *mut git_mailmap,
4128 real_name: *const c_char,
4129 real_email: *const c_char,
4130 replace_name: *const c_char,
4131 replace_email: *const c_char,
4132 ) -> c_int;
4133
4134 // email
4135 pub fn git_email_create_from_diff(
4136 out: *mut git_buf,
4137 diff: *mut git_diff,
4138 patch_idx: usize,
4139 patch_count: usize,
4140 commit_id: *const git_oid,
4141 summary: *const c_char,
4142 body: *const c_char,
4143 author: *const git_signature,
4144 given_opts: *const git_email_create_options,
4145 ) -> c_int;
4146
4147 pub fn git_email_create_from_commit(
4148 out: *mut git_buf,
4149 commit: *mut git_commit,
4150 given_opts: *const git_email_create_options,
4151 ) -> c_int;
4152
4153 pub fn git_trace_set(level: git_trace_level_t, cb: git_trace_cb) -> c_int;
4154 }
4155
4156 pub fn init() {
4157 use std::sync::Once;
4158
4159 static INIT: Once = Once::new();
4160 INIT.call_once(|| unsafe {
4161 openssl_init();
4162 ssh_init();
4163 let rc = git_libgit2_init();
4164 if rc >= 0 {
4165 // Note that we intentionally never schedule `git_libgit2_shutdown`
4166 // to get called. There's not really a great time to call that and
4167 // #276 has some more info about how automatically doing it can
4168 // cause problems.
4169 return;
4170 }
4171
4172 let git_error = git_error_last();
4173 let error = if !git_error.is_null() {
4174 CStr::from_ptr((*git_error).message).to_string_lossy()
4175 } else {
4176 "unknown error".into()
4177 };
4178 panic!(
4179 "couldn't initialize the libgit2 library: {}, error: {}",
4180 rc, error
4181 );
4182 });
4183 }
4184
4185 #[cfg(all(unix, feature = "https"))]
4186 #[doc(hidden)]
4187 pub fn openssl_init() {
4188 openssl_sys::init();
4189 }
4190
4191 #[cfg(any(windows, not(feature = "https")))]
4192 #[doc(hidden)]
4193 pub fn openssl_init() {}
4194
4195 #[cfg(feature = "ssh")]
4196 fn ssh_init() {
4197 libssh2::init();
4198 }
4199
4200 #[cfg(not(feature = "ssh"))]
4201 fn ssh_init() {}
4202
4203 #[doc(hidden)]
4204 pub fn vendored() -> bool {
4205 cfg!(libgit2_vendored)
4206 }