From 339002ee48c989d3bd9284baf6f80a0b4bac7669 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 31 Jan 2026 18:43:25 +0800 Subject: [PATCH] fix: make `ya pkg` ignore default remote name in user Git config (#3648) --- CHANGELOG.md | 2 ++ yazi-cli/src/package/git.rs | 15 +++++++++++---- yazi-parser/src/notify/push.rs | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b6b7cd8..ec8d7712 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): ### Fixed - Archive extraction fails for target paths with non-ASCII characters on Windows ([#3607]) +- Make `ya pkg` ignore default remote name in user Git config ([#3648]) ### Improved @@ -1638,3 +1639,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/): [#3634]: https://github.com/sxyazi/yazi/pull/3634 [#3638]: https://github.com/sxyazi/yazi/pull/3638 [#3642]: https://github.com/sxyazi/yazi/pull/3642 +[#3648]: https://github.com/sxyazi/yazi/pull/3648 diff --git a/yazi-cli/src/package/git.rs b/yazi-cli/src/package/git.rs index ab6d97d9..3d1e85df 100644 --- a/yazi-cli/src/package/git.rs +++ b/yazi-cli/src/package/git.rs @@ -43,10 +43,17 @@ impl Git { } async fn exec(f: impl FnOnce(&mut Command) -> &mut Command) -> Result<()> { - let status = f(Command::new("git").args(["-c", "advice.detachedHead=false"])) - .status() - .await - .context("Failed to execute `git` command")?; + let status = f(Command::new("git").args([ + "-c", + "advice.detachedHead=false", + "-c", + "checkout.defaultRemote=origin", + "-c", + "clone.defaultRemoteName=origin", + ])) + .status() + .await + .context("Failed to execute `git` command")?; if !status.success() { bail!("`git` command failed: {status}"); diff --git a/yazi-parser/src/notify/push.rs b/yazi-parser/src/notify/push.rs index 75160845..350e1e79 100644 --- a/yazi-parser/src/notify/push.rs +++ b/yazi-parser/src/notify/push.rs @@ -12,6 +12,7 @@ use yazi_shared::event::CmdCow; pub struct PushOpt { pub title: String, pub content: String, + #[serde(default)] pub level: PushLevel, #[serde_as(as = "DurationSecondsWithFrac")] pub timeout: Duration,