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