fix: make ya pkg ignore default remote name in user Git config (#3648)

This commit is contained in:
sxyazi 2026-01-31 18:43:25 +08:00
parent a015d4a7ef
commit 339002ee48
No known key found for this signature in database
3 changed files with 14 additions and 4 deletions

View file

@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/):
### Fixed ### Fixed
- Archive extraction fails for target paths with non-ASCII characters on Windows ([#3607]) - 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 ### 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 [#3634]: https://github.com/sxyazi/yazi/pull/3634
[#3638]: https://github.com/sxyazi/yazi/pull/3638 [#3638]: https://github.com/sxyazi/yazi/pull/3638
[#3642]: https://github.com/sxyazi/yazi/pull/3642 [#3642]: https://github.com/sxyazi/yazi/pull/3642
[#3648]: https://github.com/sxyazi/yazi/pull/3648

View file

@ -43,10 +43,17 @@ impl Git {
} }
async fn exec(f: impl FnOnce(&mut Command) -> &mut Command) -> Result<()> { async fn exec(f: impl FnOnce(&mut Command) -> &mut Command) -> Result<()> {
let status = f(Command::new("git").args(["-c", "advice.detachedHead=false"])) let status = f(Command::new("git").args([
.status() "-c",
.await "advice.detachedHead=false",
.context("Failed to execute `git` command")?; "-c",
"checkout.defaultRemote=origin",
"-c",
"clone.defaultRemoteName=origin",
]))
.status()
.await
.context("Failed to execute `git` command")?;
if !status.success() { if !status.success() {
bail!("`git` command failed: {status}"); bail!("`git` command failed: {status}");

View file

@ -12,6 +12,7 @@ use yazi_shared::event::CmdCow;
pub struct PushOpt { pub struct PushOpt {
pub title: String, pub title: String,
pub content: String, pub content: String,
#[serde(default)]
pub level: PushLevel, pub level: PushLevel,
#[serde_as(as = "DurationSecondsWithFrac<f64>")] #[serde_as(as = "DurationSecondsWithFrac<f64>")]
pub timeout: Duration, pub timeout: Duration,