diff options
| -rw-r--r-- | Cargo.lock | 31 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/git_remote_helper.rs | 5 |
3 files changed, 35 insertions, 2 deletions
| @@ -373,6 +373,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 373 | checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" | 373 | checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" |
| 374 | 374 | ||
| 375 | [[package]] | 375 | [[package]] |
| 376 | name = "auth-git2" | ||
| 377 | version = "0.5.4" | ||
| 378 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 379 | checksum = "e51bd0e4592409df8631ca807716dc1e5caafae5d01ce0157c966c71c7e49c3c" | ||
| 380 | dependencies = [ | ||
| 381 | "dirs", | ||
| 382 | "git2", | ||
| 383 | "terminal-prompt", | ||
| 384 | ] | ||
| 385 | |||
| 386 | [[package]] | ||
| 376 | name = "autocfg" | 387 | name = "autocfg" |
| 377 | version = "1.2.0" | 388 | version = "1.2.0" |
| 378 | source = "registry+https://github.com/rust-lang/crates.io-index" | 389 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -814,6 +825,15 @@ dependencies = [ | |||
| 814 | ] | 825 | ] |
| 815 | 826 | ||
| 816 | [[package]] | 827 | [[package]] |
| 828 | name = "dirs" | ||
| 829 | version = "5.0.1" | ||
| 830 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 831 | checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" | ||
| 832 | dependencies = [ | ||
| 833 | "dirs-sys", | ||
| 834 | ] | ||
| 835 | |||
| 836 | [[package]] | ||
| 817 | name = "dirs-sys" | 837 | name = "dirs-sys" |
| 818 | version = "0.4.1" | 838 | version = "0.4.1" |
| 819 | source = "registry+https://github.com/rust-lang/crates.io-index" | 839 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1747,6 +1767,7 @@ dependencies = [ | |||
| 1747 | "anyhow", | 1767 | "anyhow", |
| 1748 | "assert_cmd", | 1768 | "assert_cmd", |
| 1749 | "async-trait", | 1769 | "async-trait", |
| 1770 | "auth-git2", | ||
| 1750 | "chacha20poly1305", | 1771 | "chacha20poly1305", |
| 1751 | "clap", | 1772 | "clap", |
| 1752 | "console", | 1773 | "console", |
| @@ -3041,6 +3062,16 @@ dependencies = [ | |||
| 3041 | ] | 3062 | ] |
| 3042 | 3063 | ||
| 3043 | [[package]] | 3064 | [[package]] |
| 3065 | name = "terminal-prompt" | ||
| 3066 | version = "0.2.3" | ||
| 3067 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 3068 | checksum = "572818b3472910acbd5dff46a3413715c18e934b071ab2ba464a7b2c2af16376" | ||
| 3069 | dependencies = [ | ||
| 3070 | "libc", | ||
| 3071 | "winapi", | ||
| 3072 | ] | ||
| 3073 | |||
| 3074 | [[package]] | ||
| 3044 | name = "termtree" | 3075 | name = "termtree" |
| 3045 | version = "0.4.1" | 3076 | version = "0.4.1" |
| 3046 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3077 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -14,6 +14,7 @@ categories = ["command-line-utilities","git"] | |||
| 14 | [dependencies] | 14 | [dependencies] |
| 15 | anyhow = "1.0.75" | 15 | anyhow = "1.0.75" |
| 16 | async-trait = "0.1.73" | 16 | async-trait = "0.1.73" |
| 17 | auth-git2 = "0.5.4" | ||
| 17 | chacha20poly1305 = "0.10.1" | 18 | chacha20poly1305 = "0.10.1" |
| 18 | clap = { version = "4.3.19", features = ["derive"] } | 19 | clap = { version = "4.3.19", features = ["derive"] } |
| 19 | console = "0.15.7" | 20 | console = "0.15.7" |
diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index 6050d1a..2899fec 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs | |||
| @@ -13,6 +13,7 @@ use std::{ | |||
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | use anyhow::{bail, Context, Result}; | 15 | use anyhow::{bail, Context, Result}; |
| 16 | use auth_git2::GitAuthenticator; | ||
| 16 | #[cfg(not(test))] | 17 | #[cfg(not(test))] |
| 17 | use client::Connect; | 18 | use client::Connect; |
| 18 | use client::{fetching_with_report, get_repo_ref_from_cache}; | 19 | use client::{fetching_with_report, get_repo_ref_from_cache}; |
| @@ -97,8 +98,8 @@ async fn main() -> Result<()> { | |||
| 97 | println!(); | 98 | println!(); |
| 98 | } | 99 | } |
| 99 | ["push", refspec] => { | 100 | ["push", refspec] => { |
| 100 | temp_remote.connect(git2::Direction::Push)?; | 101 | let auth = GitAuthenticator::default(); |
| 101 | temp_remote.push(&[refspec], None)?; | 102 | auth.push(&git_repo.git_repo, &mut temp_remote, &[refspec])?; |
| 102 | temp_remote.disconnect()?; | 103 | temp_remote.disconnect()?; |
| 103 | println!(); | 104 | println!(); |
| 104 | } | 105 | } |