Skip to content

Commit

Permalink
Fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
mjarkk committed Jun 1, 2020
1 parent c403187 commit c4e150b
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1611,18 +1611,6 @@ impl DetailedTomlDependency {
}
}

if let Some(git) = self.git.clone() {
if let Ok(url) = git.into_url() {
if url.fragment().is_some() {
let msg = format!(
"hash in git url is ignored for dependency ({}). \
If you were trying to specify a specific git revision, use rev = \"revision\".",
name_in_toml);
cx.warnings.push(msg)
}
}
}

let new_source_id = match (
self.git.as_ref(),
self.path.as_ref(),
Expand Down Expand Up @@ -1673,6 +1661,17 @@ impl DetailedTomlDependency {
.or_else(|| self.rev.clone().map(GitReference::Rev))
.unwrap_or_else(|| GitReference::Branch("master".to_string()));
let loc = git.into_url()?;

if let Some(fragment) = loc.fragment() {
let msg = format!(
"URL fragment `#{}` in git URL is ignored for dependency ({}). \
If you were trying to specify a specific git revision, \
use `rev = \"{}\"` in the dependency declaration.",
fragment, name_in_toml, fragment
);
cx.warnings.push(msg)
}

SourceId::for_git(&loc, reference)?
}
(None, Some(path), _, _) => {
Expand Down

0 comments on commit c4e150b

Please sign in to comment.