Skip to content

Commit 273285f

Browse files
committed
add TODOs for setting git pretty_ref to url encoding
To make things more consistent, we will change to `pretty_ref(true)` when we are going to stabilize lockfile v4.
1 parent 65b292f commit 273285f

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/cargo/core/source/source_id.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ impl fmt::Display for SourceId {
575575
// Don't replace the URL display for git references,
576576
// because those are kind of expected to be URLs.
577577
write!(f, "{}", self.inner.url)?;
578+
// TODO(-Znext-lockfile-bump): set it to true when stabilizing
579+
// lockfile v4, because we want Source ID serialization to be
580+
// consistent with lockfile.
578581
if let Some(pretty) = reference.pretty_ref(false) {
579582
write!(f, "?{}", pretty)?;
580583
}

src/cargo/sources/git/source.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ impl<'cfg> Debug for GitSource<'cfg> {
164164
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
165165
write!(f, "git repo at {}", self.remote.url())?;
166166

167+
// TODO(-Znext-lockfile-bump): set it to true when stabilizing
168+
// lockfile v4, because we want Source ID serialization to be
169+
// consistent with lockfile.
167170
match self.manifest_reference.pretty_ref(false) {
168171
Some(s) => write!(f, " ({})", s),
169172
None => Ok(()),

src/cargo/util/toml_mut/dependency.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,10 @@ impl GitSource {
881881
impl std::fmt::Display for GitSource {
882882
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
883883
let git_ref = self.git_ref();
884+
885+
// TODO(-Znext-lockfile-bump): set it to true when stabilizing
886+
// lockfile v4, because we want Source ID serialization to be
887+
// consistent with lockfile.
884888
if let Some(pretty_ref) = git_ref.pretty_ref(false) {
885889
write!(f, "{}?{}", self.git, pretty_ref)
886890
} else {

0 commit comments

Comments
 (0)