Skip to content

Commit 0d4706a

Browse files
committed
Warn if using hash in git url
1 parent 6030f57 commit 0d4706a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,6 +1611,18 @@ impl DetailedTomlDependency {
16111611
}
16121612
}
16131613

1614+
if let Some(git) = self.git.clone() {
1615+
if let Ok(url) = git.into_url() {
1616+
if url.fragment().is_some() {
1617+
let msg = format!(
1618+
"hash in git url is ignored for dependency ({}). \
1619+
if you were trying to specify a specific git revision, use rev = \"revision\".",
1620+
name_in_toml);
1621+
cx.warnings.push(msg)
1622+
}
1623+
}
1624+
}
1625+
16141626
let new_source_id = match (
16151627
self.git.as_ref(),
16161628
self.path.as_ref(),

0 commit comments

Comments
 (0)