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