summaryrefslogtreecommitdiffstats
path: root/vendor/git2/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/git2/src
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/git2/src')
-rw-r--r--vendor/git2/src/lib.rs4
-rw-r--r--vendor/git2/src/remote.rs15
-rw-r--r--vendor/git2/src/stash.rs19
-rw-r--r--vendor/git2/src/tree.rs13
4 files changed, 31 insertions, 20 deletions
diff --git a/vendor/git2/src/lib.rs b/vendor/git2/src/lib.rs
index 6dd75093b..3dd6fe92e 100644
--- a/vendor/git2/src/lib.rs
+++ b/vendor/git2/src/lib.rs
@@ -91,7 +91,7 @@ pub use crate::config::{Config, ConfigEntries, ConfigEntry};
pub use crate::cred::{Cred, CredentialHelper};
pub use crate::describe::{Describe, DescribeFormatOptions, DescribeOptions};
pub use crate::diff::{Deltas, Diff, DiffDelta, DiffFile, DiffOptions};
-pub use crate::diff::{DiffBinary, DiffBinaryFile, DiffBinaryKind};
+pub use crate::diff::{DiffBinary, DiffBinaryFile, DiffBinaryKind, DiffPatchidOptions};
pub use crate::diff::{DiffFindOptions, DiffHunk, DiffLine, DiffLineType, DiffStats};
pub use crate::email::{Email, EmailCreateOptions};
pub use crate::error::Error;
@@ -131,7 +131,7 @@ pub use crate::revert::RevertOptions;
pub use crate::revspec::Revspec;
pub use crate::revwalk::Revwalk;
pub use crate::signature::Signature;
-pub use crate::stash::{StashApplyOptions, StashApplyProgressCb, StashCb};
+pub use crate::stash::{StashApplyOptions, StashApplyProgressCb, StashCb, StashSaveOptions};
pub use crate::status::{StatusEntry, StatusIter, StatusOptions, StatusShow, Statuses};
pub use crate::submodule::{Submodule, SubmoduleUpdateOptions};
pub use crate::tag::Tag;
diff --git a/vendor/git2/src/remote.rs b/vendor/git2/src/remote.rs
index f36db6844..c8f5a935a 100644
--- a/vendor/git2/src/remote.rs
+++ b/vendor/git2/src/remote.rs
@@ -41,6 +41,7 @@ pub struct RemoteHead<'remote> {
/// Options which can be specified to various fetch operations.
pub struct FetchOptions<'cb> {
callbacks: Option<RemoteCallbacks<'cb>>,
+ depth: i32,
proxy: Option<ProxyOptions<'cb>>,
prune: FetchPrune,
update_fetchhead: bool,
@@ -509,6 +510,7 @@ impl<'cb> FetchOptions<'cb> {
follow_redirects: RemoteRedirect::Initial,
custom_headers: Vec::new(),
custom_headers_ptrs: Vec::new(),
+ depth: 0, // Not limited depth
}
}
@@ -538,6 +540,17 @@ impl<'cb> FetchOptions<'cb> {
self
}
+ /// Set fetch depth, a value less or equal to 0 is interpreted as pull
+ /// everything (effectively the same as not declaring a limit depth).
+
+ // FIXME(blyxyas): We currently don't have a test for shallow functions
+ // because libgit2 doesn't support local shallow clones.
+ // https://github.com/rust-lang/git2-rs/pull/979#issuecomment-1716299900
+ pub fn depth(&mut self, depth: i32) -> &mut Self {
+ self.depth = depth.max(0);
+ self
+ }
+
/// Set how to behave regarding tags on the remote, such as auto-downloading
/// tags for objects we're downloading or downloading all of them.
///
@@ -590,7 +603,7 @@ impl<'cb> Binding for FetchOptions<'cb> {
prune: crate::call::convert(&self.prune),
update_fetchhead: crate::call::convert(&self.update_fetchhead),
download_tags: crate::call::convert(&self.download_tags),
- depth: 0, // GIT_FETCH_DEPTH_FULL.
+ depth: self.depth,
follow_redirects: self.follow_redirects.raw(),
custom_headers: git_strarray {
count: self.custom_headers_ptrs.len(),
diff --git a/vendor/git2/src/stash.rs b/vendor/git2/src/stash.rs
index 6fcd525d2..ea898e46b 100644
--- a/vendor/git2/src/stash.rs
+++ b/vendor/git2/src/stash.rs
@@ -5,7 +5,6 @@ use libc::{c_char, c_int, c_void, size_t};
use std::ffi::{c_uint, CStr, CString};
use std::mem;
-#[allow(unused)]
/// Stash application options structure
pub struct StashSaveOptions<'a> {
message: Option<CString>,
@@ -72,13 +71,14 @@ impl<'a> StashSaveOptions<'a> {
///
/// Return `true` to continue processing, or `false` to
/// abort the stash application.
+// FIXME: This probably should have been pub(crate) since it is not used anywhere.
pub type StashApplyProgressCb<'a> = dyn FnMut(StashApplyProgress) -> bool + 'a;
/// This is a callback function you can provide to iterate over all the
/// stashed states that will be invoked per entry.
+// FIXME: This probably should have been pub(crate) since it is not used anywhere.
pub type StashCb<'a> = dyn FnMut(usize, &str, &Oid) -> bool + 'a;
-#[allow(unused)]
/// Stash application options structure
pub struct StashApplyOptions<'cb> {
progress: Option<Box<StashApplyProgressCb<'cb>>>,
@@ -144,22 +144,20 @@ impl<'cb> StashApplyOptions<'cb> {
}
}
-#[allow(unused)]
-pub struct StashCbData<'a> {
+pub(crate) struct StashCbData<'a> {
pub callback: &'a mut StashCb<'a>,
}
-#[allow(unused)]
-pub extern "C" fn stash_cb(
+pub(crate) extern "C" fn stash_cb(
index: size_t,
message: *const c_char,
stash_id: *const raw::git_oid,
payload: *mut c_void,
) -> c_int {
panic::wrap(|| unsafe {
- let mut data = &mut *(payload as *mut StashCbData<'_>);
+ let data = &mut *(payload as *mut StashCbData<'_>);
let res = {
- let mut callback = &mut data.callback;
+ let callback = &mut data.callback;
callback(
index,
CStr::from_ptr(message).to_str().unwrap(),
@@ -191,15 +189,14 @@ fn convert_progress(progress: raw::git_stash_apply_progress_t) -> StashApplyProg
}
}
-#[allow(unused)]
extern "C" fn stash_apply_progress_cb(
progress: raw::git_stash_apply_progress_t,
payload: *mut c_void,
) -> c_int {
panic::wrap(|| unsafe {
- let mut options = &mut *(payload as *mut StashApplyOptions<'_>);
+ let options = &mut *(payload as *mut StashApplyOptions<'_>);
let res = {
- let mut callback = options.progress.as_mut().unwrap();
+ let callback = options.progress.as_mut().unwrap();
callback(convert_progress(progress))
};
diff --git a/vendor/git2/src/tree.rs b/vendor/git2/src/tree.rs
index 78b241384..9a38244cf 100644
--- a/vendor/git2/src/tree.rs
+++ b/vendor/git2/src/tree.rs
@@ -122,10 +122,6 @@ impl<'repo> Tree<'repo> {
C: FnMut(&str, &TreeEntry<'_>) -> T,
T: Into<i32>,
{
- #[allow(unused)]
- struct TreeWalkCbData<'a, T> {
- pub callback: &'a mut TreeWalkCb<'a, T>,
- }
unsafe {
let mut data = TreeWalkCbData {
callback: &mut callback,
@@ -209,6 +205,10 @@ impl<'repo> Tree<'repo> {
type TreeWalkCb<'a, T> = dyn FnMut(&str, &TreeEntry<'_>) -> T + 'a;
+struct TreeWalkCbData<'a, T> {
+ callback: &'a mut TreeWalkCb<'a, T>,
+}
+
extern "C" fn treewalk_cb<T: Into<i32>>(
root: *const c_char,
entry: *const raw::git_tree_entry,
@@ -220,8 +220,9 @@ extern "C" fn treewalk_cb<T: Into<i32>>(
_ => return -1,
};
let entry = entry_from_raw_const(entry);
- let payload = payload as *mut &mut TreeWalkCb<'_, T>;
- (*payload)(root, &entry).into()
+ let payload = &mut *(payload as *mut TreeWalkCbData<'_, T>);
+ let callback = &mut payload.callback;
+ callback(root, &entry).into()
}) {
Some(value) => value,
None => -1,