From 1772f88882824b92fd233bc2148c4ad123740096 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 25 Jul 2024 19:00:53 +0200 Subject: [PATCH] fix: avoid `as_ref()` call as `bstr` could break downstream with new impls (#1466) As `bstr` adds a new implementation of `AsRef`, the `as_ref()` call becomes ambiguous which will then break `gitoxide`. Now `as_ref()` is avoided in favor of a method that can't fail. --- gitoxide-core/src/repository/status.rs | 4 ++-- gix-credentials/src/program/mod.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gitoxide-core/src/repository/status.rs b/gitoxide-core/src/repository/status.rs index d3180f9c251..e32cb7e23d0 100644 --- a/gitoxide-core/src/repository/status.rs +++ b/gitoxide-core/src/repository/status.rs @@ -1,5 +1,5 @@ use anyhow::bail; -use gix::bstr::{BStr, BString}; +use gix::bstr::{BStr, BString, ByteSlice}; use gix::status::index_worktree::iter::Item; use gix_status::index_as_worktree::{Change, Conflict, EntryStatus}; use std::path::Path; @@ -152,7 +152,7 @@ pub fn show( source_rela_path = gix::path::relativize_with_prefix(&gix::path::from_bstr(source.rela_path()), prefix).display(), dest_rela_path = gix::path::relativize_with_prefix( - &gix::path::from_bstr(dirwalk_entry.rela_path.as_ref()), + &gix::path::from_bstr(dirwalk_entry.rela_path.as_bstr()), prefix ) .display(), diff --git a/gix-credentials/src/program/mod.rs b/gix-credentials/src/program/mod.rs index 5f705f93b5e..c34938c4e4d 100644 --- a/gix-credentials/src/program/mod.rs +++ b/gix-credentials/src/program/mod.rs @@ -80,7 +80,7 @@ impl Program { args.insert_str(0, "credential-"); args.insert_str(0, " "); args.insert_str(0, git_program.to_string_lossy().as_ref()); - gix_command::prepare(gix_path::from_bstr(args.as_ref()).into_owned()) + gix_command::prepare(gix_path::from_bstr(args.as_bstr()).into_owned()) .arg(action.as_arg(true)) .with_shell_allow_argument_splitting() .into()