Skip to content

Commit

Permalink
refactor: rename precise_full_git_fragment to precise_git_fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Jan 4, 2024
1 parent ce551d7 commit 093f7c8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/cargo/core/source_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_generate_lockfile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
3 changes: 1 addition & 2 deletions src/cargo/sources/git/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -199,7 +199,6 @@ impl From<Revision> for GitReference {
}
}


/// Create an identifier from a URL,
/// essentially turning `proto://host/path/repo` into `repo-<hash-of-url>`.
fn ident(id: &SourceId) -> String {
Expand Down

0 comments on commit 093f7c8

Please sign in to comment.