| @@ -73,14 +73,32 @@ where · 72 unmodified lines |
| 73 | P: gix_features::progress::NestedProgress, | 73 | P: gix_features::progress::NestedProgress, |
| 74 | P::SubProgress: 'static, | 74 | P::SubProgress: 'static, |
| 75 | { | 75 | { |
| | 76 | let ref_map = &self.ref_map; |
| | 77 | if ref_map.mappings.is_empty() && !ref_map.remote_refs.is_empty() { |
| | 78 | let mut specs = ref_map.refspecs.clone(); |
| | 79 | specs.extend(ref_map.extra_refspecs.clone()); |
| | 80 | return Err(Error::NoMapping { |
| | 81 | refspecs: specs, |
| | 82 | num_remote_refs: ref_map.remote_refs.len(), |
| | 83 | }); |
| | 84 | } |
| | 85 | |
| 76 | let mut con = self.con.take().expect("receive() can only be called once"); | 86 | let mut con = self.con.take().expect("receive() can only be called once"); |
| 77 | let mut handshake = con.handshake.take().expect("receive() can only be called once"); | 87 | let mut handshake = con.handshake.take().expect("receive() can only be called once"); |
| 78 | let repo = con.remote.repo; | 88 | let repo = con.remote.repo; |
| | 89 | |
| | 90 | let expected_object_hash = repo.object_hash(); |
| | 91 | if ref_map.object_hash != expected_object_hash { |
| | 92 | return Err(Error::IncompatibleObjectHash { |
| | 93 | local: expected_object_hash, |
| | 94 | remote: ref_map.object_hash, |
| | 95 | }); |
| | 96 | } |
| | 97 | |
| 79 | let fetch_options = gix_protocol::fetch::Options { | 98 | let fetch_options = gix_protocol::fetch::Options { |
| 80 | shallow_file: repo.shallow_file(), | 99 | shallow_file: repo.shallow_file(), |
| 81 | shallow: &self.shallow, | 100 | shallow: &self.shallow, |
| 82 | tags: con.remote.fetch_tags, | 101 | tags: con.remote.fetch_tags, |
| 83 | expected_object_hash: repo.object_hash(), | | |
| 84 | reject_shallow_remote: repo | 102 | reject_shallow_remote: repo |
| 85 | .config | 103 | .config |
| 86 | .resolved | 104 | .resolved |
| @@ -95,7 +113,7 @@ where · 8 unmodified lines |
| 95 | user_agent: repo.config.user_agent_tuple(), | 113 | user_agent: repo.config.user_agent_tuple(), |
| 96 | trace_packetlines: con.trace, | 114 | trace_packetlines: con.trace, |
| 97 | }; | 115 | }; |
| 98 | let ref_map = &self.ref_map; | 116 | |
| 99 | let negotiator = repo | 117 | let negotiator = repo |
| 100 | .config | 118 | .config |
| 101 | .resolved | 119 | .resolved |
| @@ -137,7 +155,6 @@ where · 35 unmodified lines |
| 137 | let mut write_pack_bundle = None; | 155 | let mut write_pack_bundle = None; |
| 138 | | 156 | |
| 139 | let res = gix_protocol::fetch( | 157 | let res = gix_protocol::fetch( |
| 140 | ref_map, | | |
| 141 | &mut negotiate, | 158 | &mut negotiate, |
| 142 | |reader, progress, should_interrupt| -> Result<bool, gix_pack::bundle::write::Error> { | 159 | |reader, progress, should_interrupt| -> Result<bool, gix_pack::bundle::write::Error> { |
| 143 | let mut may_read_to_end = false; | 160 | let mut may_read_to_end = false; |