Compare commits

..

No commits in common. "5e4e287562347b35720d08c0268047912b37ca5e" and "7bd6347dd84c4cfef6e3615899a25abac696d9ae" have entirely different histories.

9 changed files with 94 additions and 114 deletions

159
Cargo.lock generated
View file

@ -34,7 +34,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -56,7 +56,7 @@ checksum = "7c7db3d5a9718568e4cf4a537cfd7070e6e6ff7481510d0237fb529ac850f6d3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -234,7 +234,7 @@ checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -339,7 +339,7 @@ dependencies = [
"ident_case", "ident_case",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -462,7 +462,7 @@ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -635,7 +635,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim", "strsim",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -646,7 +646,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -696,7 +696,7 @@ checksum = "841ea25b31404c50f2ddc92e028984a42d0fc818c10afee0b1fbda27c995f028"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -716,7 +716,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
"unicode-xid", "unicode-xid",
] ]
@ -1000,7 +1000,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -1087,7 +1087,7 @@ checksum = "8066dc2ef3bd0e2bfb84b4a2b0b04f216ffb97390e09fab0752bf0ba943dacc6"
dependencies = [ dependencies = [
"doc-comment", "doc-comment",
"unicase", "unicase",
"winnow", "winnow 0.6.18",
] ]
[[package]] [[package]]
@ -1120,8 +1120,8 @@ dependencies = [
"rand", "rand",
"ratatui", "ratatui",
"regex", "regex",
"rstest 0.23.0", "rstest",
"secrecy 0.10.3", "secrecy",
"sendmail", "sendmail",
"serde_json", "serde_json",
"standardwebhooks", "standardwebhooks",
@ -1154,7 +1154,7 @@ dependencies = [
"pike", "pike",
"pretty_assertions", "pretty_assertions",
"rand", "rand",
"secrecy 0.10.3", "secrecy",
"serde", "serde",
"serde_json", "serde_json",
"take-until", "take-until",
@ -1175,7 +1175,7 @@ dependencies = [
"git-next-core", "git-next-core",
"kxio", "kxio",
"rand", "rand",
"secrecy 0.10.3", "secrecy",
"serde", "serde",
"serde_json", "serde_json",
"tokio", "tokio",
@ -1195,7 +1195,7 @@ dependencies = [
"hmac", "hmac",
"kxio", "kxio",
"rand", "rand",
"secrecy 0.10.3", "secrecy",
"serde", "serde",
"serde_json", "serde_json",
"sha2", "sha2",
@ -1288,7 +1288,7 @@ dependencies = [
"gix-utils", "gix-utils",
"itoa", "itoa",
"thiserror", "thiserror",
"winnow", "winnow 0.6.18",
] ]
[[package]] [[package]]
@ -1384,7 +1384,7 @@ dependencies = [
"smallvec", "smallvec",
"thiserror", "thiserror",
"unicode-bom", "unicode-bom",
"winnow", "winnow 0.6.18",
] ]
[[package]] [[package]]
@ -1669,7 +1669,7 @@ dependencies = [
"itoa", "itoa",
"smallvec", "smallvec",
"thiserror", "thiserror",
"winnow", "winnow 0.6.18",
] ]
[[package]] [[package]]
@ -1793,7 +1793,7 @@ dependencies = [
"gix-utils", "gix-utils",
"maybe-async", "maybe-async",
"thiserror", "thiserror",
"winnow", "winnow 0.6.18",
] ]
[[package]] [[package]]
@ -1825,7 +1825,7 @@ dependencies = [
"gix-validate", "gix-validate",
"memmap2", "memmap2",
"thiserror", "thiserror",
"winnow", "winnow 0.6.18",
] ]
[[package]] [[package]]
@ -2486,7 +2486,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b23a0c8dfe501baac4adf6ebbfa6eddf8f0c07f56b058cc1288017e32397846c" checksum = "b23a0c8dfe501baac4adf6ebbfa6eddf8f0c07f56b058cc1288017e32397846c"
dependencies = [ dependencies = [
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -2611,7 +2611,7 @@ dependencies = [
"http 1.1.0", "http 1.1.0",
"path-clean", "path-clean",
"reqwest", "reqwest",
"secrecy 0.8.0", "secrecy",
"serde", "serde",
"serde-xml-rs", "serde-xml-rs",
"serde_json", "serde_json",
@ -2746,7 +2746,7 @@ checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -2852,7 +2852,7 @@ dependencies = [
"cfg-if", "cfg-if",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -3032,7 +3032,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -3135,7 +3135,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -3215,11 +3215,11 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "3.2.0" version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
dependencies = [ dependencies = [
"toml_edit", "toml_edit 0.21.1",
] ]
[[package]] [[package]]
@ -3523,19 +3523,7 @@ checksum = "7b423f0e62bdd61734b67cd21ff50871dfaeb9cc74f869dcd6af974fbcb19936"
dependencies = [ dependencies = [
"futures", "futures",
"futures-timer", "futures-timer",
"rstest_macros 0.22.0", "rstest_macros",
"rustc_version",
]
[[package]]
name = "rstest"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a2c585be59b6b5dd66a9d2084aa1d8bd52fbdb806eafdeffb52791147862035"
dependencies = [
"futures",
"futures-timer",
"rstest_macros 0.23.0",
"rustc_version", "rustc_version",
] ]
@ -3553,25 +3541,7 @@ dependencies = [
"regex", "regex",
"relative-path", "relative-path",
"rustc_version", "rustc_version",
"syn 2.0.82", "syn 2.0.76",
"unicode-ident",
]
[[package]]
name = "rstest_macros"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "825ea780781b15345a146be27eaefb05085e337e869bff01b4306a4fd4a9ad5a"
dependencies = [
"cfg-if",
"glob",
"proc-macro-crate",
"proc-macro2",
"quote",
"regex",
"relative-path",
"rustc_version",
"syn 2.0.82",
"unicode-ident", "unicode-ident",
] ]
@ -3601,9 +3571,9 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
version = "0.4.1" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [ dependencies = [
"semver", "semver",
] ]
@ -3713,15 +3683,6 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "secrecy"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e891af845473308773346dc847b2c23ee78fe442e0472ac50e22a18a93d3ae5a"
dependencies = [
"zeroize",
]
[[package]] [[package]]
name = "security-framework" name = "security-framework"
version = "2.11.1" version = "2.11.1"
@ -3786,7 +3747,7 @@ checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -4008,7 +3969,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion", "rustversion",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -4030,9 +3991,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.82" version = "2.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -4113,7 +4074,7 @@ checksum = "5999e24eaa32083191ba4e425deb75cdf25efefabe5aaccb7446dd0d4122a3f5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -4133,7 +4094,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -4206,7 +4167,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -4264,7 +4225,7 @@ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"toml_edit", "toml_edit 0.22.20",
] ]
[[package]] [[package]]
@ -4276,6 +4237,17 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "toml_edit"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
dependencies = [
"indexmap",
"toml_datetime",
"winnow 0.5.40",
]
[[package]] [[package]]
name = "toml_edit" name = "toml_edit"
version = "0.22.20" version = "0.22.20"
@ -4286,7 +4258,7 @@ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"winnow", "winnow 0.6.18",
] ]
[[package]] [[package]]
@ -4336,7 +4308,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]
@ -4402,7 +4374,7 @@ checksum = "27a65189ac0c5f8af32660c453a1babae3ac7e72791b9dbeb1221073569f44ea"
dependencies = [ dependencies = [
"indoc", "indoc",
"ratatui", "ratatui",
"rstest 0.22.0", "rstest",
] ]
[[package]] [[package]]
@ -4473,9 +4445,9 @@ checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.13" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]] [[package]]
name = "unicode-normalization" name = "unicode-normalization"
@ -4644,7 +4616,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -4678,7 +4650,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -4989,6 +4961,15 @@ version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.6.18" version = "0.6.18"
@ -5037,7 +5018,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.82", "syn 2.0.76",
] ]
[[package]] [[package]]

View file

@ -68,7 +68,7 @@ serde_json = "1.0"
toml = "0.8" toml = "0.8"
# Secrets and Password # Secrets and Password
secrecy = "0.10" secrecy = "0.8"
# Conventional Commit check # Conventional Commit check
git-conventional = "0.12" git-conventional = "0.12"
@ -118,4 +118,4 @@ pretty_assertions = "1.4"
rand = "0.8" rand = "0.8"
mockall = "0.13" mockall = "0.13"
test-log = "0.2" test-log = "0.2"
rstest = { version = "0.23", features = ["async-timeout"] } rstest = { version = "0.22", features = ["async-timeout"] }

View file

@ -6,7 +6,7 @@ use git_next_core::{
ApiToken, ForgeType, GitDir, Hostname, RepoBranches, RepoConfig, RepoConfigSource, RepoPath, ApiToken, ForgeType, GitDir, Hostname, RepoBranches, RepoConfig, RepoConfigSource, RepoPath,
StoragePathType, User, StoragePathType, User,
}; };
use secrecy::SecretString; use secrecy::Secret;
type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
@ -59,7 +59,7 @@ fn repo_details_find_default_push_remote_finds_correct_remote() -> Result<()> {
repo_details.forge = repo_details repo_details.forge = repo_details
.forge .forge
.with_user(User::new("git".to_string())) .with_user(User::new("git".to_string()))
.with_token(ApiToken::new(SecretString::from(String::new()))) .with_token(ApiToken::new(Secret::new(String::new())))
.with_hostname(Hostname::new("git.kemitix.net")); .with_hostname(Hostname::new("git.kemitix.net"));
repo_details.repo_path = RepoPath::new("kemitix/git-next".to_string()); repo_details.repo_path = RepoPath::new("kemitix/git-next".to_string());
let Ok(open_repository) = git::repository::factory::real().open(&repo_details) else { let Ok(open_repository) = git::repository::factory::real().open(&repo_details) else {
@ -95,7 +95,7 @@ fn gitdir_validate_should_pass_a_valid_git_repo() -> Result<()> {
repo_details.forge = repo_details repo_details.forge = repo_details
.forge .forge
.with_user(User::new("git".to_string())) .with_user(User::new("git".to_string()))
.with_token(ApiToken::new(SecretString::from(String::new()))) .with_token(ApiToken::new(Secret::new(String::new())))
.with_hostname(Hostname::new("git.kemitix.net")); .with_hostname(Hostname::new("git.kemitix.net"));
tracing::debug!("opening..."); tracing::debug!("opening...");
let Ok(repository) = git::repository::factory::real().open(&repo_details) else { let Ok(repository) = git::repository::factory::real().open(&repo_details) else {
@ -129,7 +129,7 @@ fn gitdir_validate_should_fail_a_git_repo_with_wrong_remote() {
repo_details.forge = repo_details repo_details.forge = repo_details
.forge .forge
.with_user(User::new("git".to_string())) .with_user(User::new("git".to_string()))
.with_token(ApiToken::new(SecretString::from(String::new()))) .with_token(ApiToken::new(Secret::new(String::new())))
.with_hostname(Hostname::new("git.kemitix.net")); .with_hostname(Hostname::new("git.kemitix.net"));
let Ok(repository) = git::repository::factory::real().open(&repo_details) else { let Ok(repository) = git::repository::factory::real().open(&repo_details) else {
// .git directory may not be present on dev environment // .git directory may not be present on dev environment

View file

@ -2,10 +2,10 @@
/// `ForgeJo`: <https://{hostname}/user/settings/applications> /// `ForgeJo`: <https://{hostname}/user/settings/applications>
/// `Github`: <https://github.com/settings/tokens> /// `Github`: <https://github.com/settings/tokens>
#[derive(Clone, Debug, derive_more::Constructor)] #[derive(Clone, Debug, derive_more::Constructor)]
pub struct ApiToken(secrecy::SecretString); pub struct ApiToken(secrecy::Secret<String>);
/// The API Token is in effect a password, so it must be explicitly exposed to access its value /// The API Token is in effect a password, so it must be explicitly exposed to access its value
impl secrecy::ExposeSecret<str> for ApiToken { impl secrecy::ExposeSecret<String> for ApiToken {
fn expose_secret(&self) -> &str { fn expose_secret(&self) -> &String {
self.0.expose_secret() self.0.expose_secret()
} }
} }

View file

@ -10,7 +10,7 @@ use std::{
use derive_more::{Constructor, Display}; use derive_more::{Constructor, Display};
use kxio::fs::FileSystem; use kxio::fs::FileSystem;
use secrecy::SecretString; use secrecy::Secret;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::info; use tracing::info;
@ -242,11 +242,8 @@ impl Shout {
self.webhook.clone().map(|x| x.url) self.webhook.clone().map(|x| x.url)
} }
pub fn webhook_secret(&self) -> Option<SecretString> { pub fn webhook_secret(&self) -> Option<Secret<String>> {
self.webhook self.webhook.clone().map(|x| x.secret).map(Secret::new)
.clone()
.map(|x| x.secret)
.map(SecretString::from)
} }
#[must_use] #[must_use]
@ -281,8 +278,8 @@ impl OutboundWebhook {
self.url.as_ref() self.url.as_ref()
} }
#[must_use] #[must_use]
pub fn secret(&self) -> SecretString { pub fn secret(&self) -> Secret<String> {
SecretString::from(self.secret.clone()) Secret::new(self.secret.clone())
} }
} }

View file

@ -539,7 +539,7 @@ mod server {
let shout_webhook_url = shout.webhook_url().unwrap_or_default(); let shout_webhook_url = shout.webhook_url().unwrap_or_default();
let shout_webhook_secret = shout let shout_webhook_secret = shout
.webhook_secret() .webhook_secret()
.map(|secret| secret.expose_secret().to_string()) .map(|secret| secret.expose_secret().clone())
.unwrap_or_default(); .unwrap_or_default();
let_assert!(Some(shout_email) = shout.email()); let_assert!(Some(shout_email) = shout.email());
let shout_email_from = shout_email.from(); let shout_email_from = shout_email.from();

View file

@ -11,7 +11,7 @@ use crate::{
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use secrecy::{ExposeSecret, SecretString}; use secrecy::{ExposeSecret, Secret};
use tracing::instrument; use tracing::instrument;
/// The derived information about a repo, used to interact with it /// The derived information about a repo, used to interact with it
@ -53,7 +53,7 @@ impl RepoDetails {
), ),
} }
} }
pub(crate) fn origin(&self) -> secrecy::SecretString { pub(crate) fn origin(&self) -> secrecy::Secret<String> {
let repo_details = self; let repo_details = self;
let user = &repo_details.forge.user(); let user = &repo_details.forge.user();
let hostname = &repo_details.forge.hostname(); let hostname = &repo_details.forge.hostname();
@ -78,7 +78,7 @@ impl RepoDetails {
} }
// url is a secret as it contains auth token // url is a secret as it contains auth token
pub(crate) fn url(&self) -> SecretString { pub(crate) fn url(&self) -> Secret<String> {
let user = self.forge.user(); let user = self.forge.user();
let token = self.forge.token().expose_secret(); let token = self.forge.token().expose_secret();
let auth_delim = if token.is_empty() { "" } else { ":" }; let auth_delim = if token.is_empty() { "" } else { ":" };

View file

@ -60,8 +60,10 @@ impl RepositoryFactory for RealRepositoryFactory {
fn git_clone(&self, repo_details: &RepoDetails) -> Result<Box<dyn OpenRepositoryLike>> { fn git_clone(&self, repo_details: &RepoDetails) -> Result<Box<dyn OpenRepositoryLike>> {
tracing::info!("creating"); tracing::info!("creating");
let (gix_repo, _outcome) = let (gix_repo, _outcome) = gix::prepare_clone_bare(
gix::prepare_clone_bare(repo_details.origin().expose_secret(), &*repo_details.gitdir)? repo_details.origin().expose_secret().as_str(),
&*repo_details.gitdir,
)?
.fetch_only(gix::progress::Discard, &AtomicBool::new(false))?; .fetch_only(gix::progress::Discard, &AtomicBool::new(false))?;
tracing::info!("created"); tracing::info!("created");
let repo = RealOpenRepository::new( let repo = RealOpenRepository::new(

View file

@ -112,7 +112,7 @@ impl super::OpenRepositoryLike for RealOpenRepository {
} }
}; };
// INFO: never log the command as it contains the API token within the 'origin' // INFO: never log the command as it contains the API token within the 'origin'
let command: secrecy::SecretString = format!( let command: secrecy::Secret<String> = format!(
"/usr/bin/git push {} {to_commit}:{branch_name} {force}", "/usr/bin/git push {} {to_commit}:{branch_name} {force}",
origin.expose_secret() origin.expose_secret()
) )