@@ -95,16 +95,19 @@ impl LifecycleKind for GitReporterLifecycle {
9595 }
9696}
9797
98- /// Dedup key for a git checkout. Keyed on [`RepositoryReference`]
99- /// (normalized URL + reference, no `precise`) so callers that differ
100- /// only in whether they pre-resolved the commit still dedup.
98+ /// Dedup key for a git checkout. Keyed on the full [`GitUrl`]: URL,
99+ /// reference, AND `precise` commit, so a caller asking for a specific
100+ /// commit doesn't collide with one asking only for the branch.
101+ /// Stripping `precise` from the key let `checkout_pinned_source(A)`
102+ /// silently return the branch's HEAD instead of commit `A`
103+ /// (prefix-dev/pixi#6073).
101104#[ derive( Clone , Debug , Display , Hash , PartialEq , Eq ) ]
102- #[ display( "{}@{}" , _0. url . as_url ( ) , _0. reference) ]
103- pub struct CheckoutGit ( RepositoryReference ) ;
105+ #[ display( "{}@{}" , _0. repository ( ) , _0. reference( ) ) ]
106+ pub struct CheckoutGit ( GitUrl ) ;
104107
105108impl CheckoutGit {
106109 pub fn new ( git_url : & GitUrl ) -> Self {
107- Self ( RepositoryReference :: from ( git_url) )
110+ Self ( git_url. clone ( ) )
108111 }
109112}
110113
@@ -119,8 +122,9 @@ impl Key for CheckoutGit {
119122 let semaphore = data. git_checkout_semaphore ( ) . cloned ( ) ;
120123 let reporter = data. git_checkout_reporter ( ) . cloned ( ) ;
121124
125+ let reporter_env = RepositoryReference :: from ( & self . 0 ) ;
122126 let lifecycle =
123- ReporterLifecycle :: < GitReporterLifecycle > :: queued ( reporter. as_deref ( ) , & self . 0 ) ;
127+ ReporterLifecycle :: < GitReporterLifecycle > :: queued ( reporter. as_deref ( ) , & reporter_env ) ;
124128
125129 let _permit = match semaphore. as_ref ( ) {
126130 Some ( s) => Some (
@@ -132,14 +136,12 @@ impl Key for CheckoutGit {
132136 } ;
133137 let _lifecycle = lifecycle. start ( ) ;
134138
135- // `from_reference` auto-fills `precise` from a full-commit
136- // reference, so the resolver skips ref-resolution when it can.
137- let git_url =
138- GitUrl :: from_reference ( self . 0 . url . clone ( ) . into_url ( ) , self . 0 . reference . clone ( ) ) ;
139-
139+ // Pass the original `GitUrl` straight through so the resolver
140+ // honours `precise` when set (pinned checkout) and advances to
141+ // the branch HEAD when not (fresh resolve).
140142 Arc :: new (
141143 resolver
142- . fetch ( git_url , client, cache_dir. into_std_path_buf ( ) , None )
144+ . fetch ( self . 0 . clone ( ) , client, cache_dir. into_std_path_buf ( ) , None )
143145 . await ,
144146 )
145147 }
0 commit comments