Skip to content

Commit

Permalink
adapt to changes in git-repository and git-transport
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Dec 29, 2022
1 parent 61d89f5 commit d336368
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
4 changes: 2 additions & 2 deletions etc/check-package-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ echo "in root: gitoxide CLI"
(enter git-lock && indent cargo diet -n --package-size-limit 20KB)
(enter git-config && indent cargo diet -n --package-size-limit 120KB)
(enter git-config-value && indent cargo diet -n --package-size-limit 20KB)
(enter git-command && indent cargo diet -n --package-size-limit 5KB)
(enter git-command && indent cargo diet -n --package-size-limit 10KB)
(enter git-hash && indent cargo diet -n --package-size-limit 30KB)
(enter git-chunk && indent cargo diet -n --package-size-limit 10KB)
(enter git-rebase && indent cargo diet -n --package-size-limit 5KB)
Expand Down Expand Up @@ -59,5 +59,5 @@ echo "in root: gitoxide CLI"
(enter git-protocol && indent cargo diet -n --package-size-limit 80KB)
(enter git-packetline && indent cargo diet -n --package-size-limit 35KB)
(enter git-repository && indent cargo diet -n --package-size-limit 250KB)
(enter git-transport && indent cargo diet -n --package-size-limit 75KB)
(enter git-transport && indent cargo diet -n --package-size-limit 80KB)
(enter gitoxide-core && indent cargo diet -n --package-size-limit 100KB)
1 change: 1 addition & 0 deletions git-repository/src/remote/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ impl<'repo> Remote<'repo> {
P: Progress,
{
let (url, version) = self.sanitized_url_and_version(direction)?;
#[cfg(feature = "blocking-network-client")]
let scheme_is_ssh = url.scheme == git_url::Scheme::Ssh;
let transport = git_protocol::transport::connect(
url,
Expand Down
3 changes: 3 additions & 0 deletions git-repository/tests/repository/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ mod ssh_options {
#[cfg(any(feature = "blocking-network-client", feature = "async-network-client"))]
mod transport_options;

#[cfg(feature = "blocking-network-client")]
use git_repository as git;
#[cfg(feature = "blocking-network-client")]
pub fn repo(name: &str) -> git::Repository {
repo_opts(name, |opts| opts.strict_config(true))
}

#[cfg(feature = "blocking-network-client")]
pub fn repo_opts(name: &str, modify: impl FnOnce(git::open::Options) -> git::open::Options) -> git::Repository {
let dir = git_testtools::scripted_fixture_read_only("make_config_repos.sh").unwrap();
git::open_opts(dir.join(name), modify(git::open::Options::isolated())).unwrap()
Expand Down
17 changes: 15 additions & 2 deletions gitoxide-core/src/pack/receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ mod blocking_io {
P: Progress,
P::SubProgress: 'static,
{
let transport = net::connect(url, protocol.unwrap_or_default().into())?;
let transport = net::connect(
url,
git::protocol::transport::client::connect::Options {
version: protocol.unwrap_or_default().into(),
..Default::default()
},
)?;
let delegate = CloneDelegate {
ctx,
directory,
Expand Down Expand Up @@ -236,7 +242,14 @@ mod async_io {
P: Progress + 'static,
W: io::Write + Send + 'static,
{
let transport = net::connect(url.to_string(), protocol.unwrap_or_default().into()).await?;
let transport = net::connect(
url,
git::protocol::transport::client::connect::Options {
version: protocol.unwrap_or_default().into(),
..Default::default()
},
)
.await?;
let mut delegate = CloneDelegate {
ctx,
directory,
Expand Down
11 changes: 9 additions & 2 deletions src/plumbing/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ static GIT_CONFIG: &[Record] = &[
},
Record {
config: "core.sshCommand",
usage: Planned { note: Some("unclear right now how to configure it, needs adjustment on Command based transport, must be lazy then making `connect()` a no-op essentially.") },
usage: InModule { name: "repository::config", deviation: None }
},
Record {
config: "ssh.variant",
usage: Planned { note: Some("another way to select which ssh program to use, but formalizing it to choose correct arguments. Based on the basename otherwise. Detection is attempted otherwise with `-G`") },
usage: InModule { name: "repository::config", deviation: Some("We error if a variant is chosen that we don't know, as opposed to defaulting to 'ssh'") }
},
Record {
config: "core.fileMode",
Expand Down Expand Up @@ -884,6 +884,13 @@ static GIT_CONFIG: &[Record] = &[
deviation: Some("corresponds to the EMAIL environment variable and is a fallback for `user.email`")
}
},
Record {
config: "gitoxide.ssh.commandWithoutShellFallback",
usage: InModule {
name: "repository::config",
deviation: Some("Corresponds to the value of `GIT_SSH` and is always executed without shell and treated as fallback.")
}
},
Record {
config: "gitoxide.objects.cacheLimit",
usage: InModule {
Expand Down

0 comments on commit d336368

Please sign in to comment.