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