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