From 093f7c837026a9f75cced4b637cfafef51c92a2a Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Thu, 4 Jan 2024 16:29:56 -0500 Subject: [PATCH] refactor: rename precise_full_git_fragment to precise_git_fragment --- src/cargo/core/source_id.rs | 4 ---- src/cargo/ops/cargo_generate_lockfile.rs | 2 +- src/cargo/sources/git/source.rs | 3 +-- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/cargo/core/source_id.rs b/src/cargo/core/source_id.rs index 6e6d9d9d84b..1c4982ceb9c 100644 --- a/src/cargo/core/source_id.rs +++ b/src/cargo/core/source_id.rs @@ -460,10 +460,6 @@ impl SourceId { } pub fn precise_git_fragment(self) -> Option<&'static str> { - self.precise_full_git_fragment().map(|s| &s[..8]) - } - - pub fn precise_full_git_fragment(self) -> Option<&'static str> { match &self.inner.precise { Some(Precise::GitUrlFragment(s)) => Some(&s), _ => None, diff --git a/src/cargo/ops/cargo_generate_lockfile.rs b/src/cargo/ops/cargo_generate_lockfile.rs index 1bba64925ec..e638c69390f 100644 --- a/src/cargo/ops/cargo_generate_lockfile.rs +++ b/src/cargo/ops/cargo_generate_lockfile.rs @@ -167,7 +167,7 @@ pub fn update_lockfile(ws: &Workspace<'_>, opts: &UpdateOptions<'_>) -> CargoRes format!( "{} -> #{}", removed[0], - &added[0].source_id().precise_git_fragment().unwrap() + &added[0].source_id().precise_git_fragment().unwrap()[..8], ) } else { format!("{} -> v{}", removed[0], added[0].version()) diff --git a/src/cargo/sources/git/source.rs b/src/cargo/sources/git/source.rs index 8cfd520cddd..c8f14737c0a 100644 --- a/src/cargo/sources/git/source.rs +++ b/src/cargo/sources/git/source.rs @@ -103,7 +103,7 @@ impl<'cfg> GitSource<'cfg> { let remote = GitRemote::new(source_id.url()); // Fallback to git ref from mainfest if there is no locked revision. let locked_rev = source_id - .precise_full_git_fragment() + .precise_git_fragment() .map(|s| Revision::new(s.into())) .unwrap_or_else(|| source_id.git_reference().unwrap().clone().into()); @@ -199,7 +199,6 @@ impl From for GitReference { } } - /// Create an identifier from a URL, /// essentially turning `proto://host/path/repo` into `repo-`. fn ident(id: &SourceId) -> String {